报表内容为:数据集为ADOQuery1,字段包括序号、名称、备注,因为为了节约纸张,所以要实现双排
打印。请问应如何做!!!打印样式如下
               开票打印记录序号  名称  备注  序号  名称  备注
1       aa     -      6      sd     - 
2       ss     -      7      gs     -
3       ds     -      8      sf     -
4       gd     -  
5       dg     -

解决方案 »

  1.   

    select a.id 序号,convert(char(12),a.jssj,102) 日期,a.yhsj 结果, 
           b.id 序号_1,convert(char(12),b.jssj,102) 日期_1,b.yhsj 结果_1,
           c.id 序号_2,convert(char(12),c.jssj,102) 日期_2,c.yhsj 结果_2
     from #t1 a,#t1 b,#t1 c
    where a.id=b.id-@x
      and b.id=c.id-@x
      

  2.   

    select IDENTITY(int, 1,1) id,jssj,yhsj 
       into #t
       from #tt
     order by jssjdeclare @maxid intselect @maxid=max(id) from #tdeclare @n int
    select @n=(3-abs(@m-(@m/3)*3))declare @x intif @n<>3
      select @x=(@m+@n)/3
    else
      select @x=@m/3 --计算每列的行数if @n<>3  --将数据集的数目弄成可以被3整除的
    begin
      while @n<>0
        begin
          select @maxid=@maxid+1
          insert into #t (jssj,yhsj) values(null,null)
          select @n=@n-1
        end 
    end 
    select *  into #t1 from #t order by id--排位置,排成3列
    select a.id 序号,convert(char(12),a.jssj,102) 名称,a.yhsj 备注, 
           b.id 序号_1,convert(char(12),b.jssj,102) 名称_1,b.yhsj 备注_1,
           c.id 序号_2,convert(char(12),c.jssj,102) 名称_2,c.yhsj 备注_2
     from #t1 a,#t1 b,#t1 c
    where a.id=b.id-@x
      and b.id=c.id-@x
      

  3.   

    还有一种办法就先把表的记录除以2生成一个临时表,表的字段为
    “ID 序号  名称  备注  序号  名称  备注”ID要先生成连续的序号,再建一个游标根据ID来循环Update数据就可以了。
      

  4.   

    select a.id 序号,convert(char(12),a.jssj,102) 日期,a.yhsj 结果, 
           b.id 序号_1,convert(char(12),b.jssj,102) 日期_1,b.yhsj 结果_1,
           c.id 序号_2,convert(char(12),c.jssj,102) 日期_2,c.yhsj 结果_2
     from #t1 a,#t1 b,#t1 c
    where a.id=b.id-@x
      and b.id=c.id-@x