我有如下的数据表    id parent mc 
    1  0      A 
    2  1      aa
    3  1      bb
    4  2      aa1
    5  2      aa2
    6  2      aa3
    7  3      bb1
    8  3      bb2
可直接形成如下的
    A--aa---aa1
      |    | 
      |    |-aa2
     |
     |-bb---bb1 
          |   
            -bb2    怎样实现数据的分组报表

解决方案 »

  1.   

            字段1,字段2,字段3
            A--aa----------aa1 
            |    ¦        ¦   
            A _ aa ____   ¦-aa2 
            }    ¦        |
            A _ bb--------bb1   
            |   |         ¦       
            A  _bb -----  -bb2 declare @t table (a int ,b int ,c varchar(10))
    insert into @t select  1 ,    0  ,           'A'   
    insert into @t select  2  ,   1  ,           'aa' 
    insert into @t select  3  ,   1  ,           'bb' 
    insert into @t select  4  ,   2  ,           'aa1' 
    insert into @t select  5  ,   2  ,           'aa2' 
    insert into @t select  6  ,   2  ,           'aa3' 
    insert into @t select  7 ,    3 ,            'bb1' 
     select 'A'AS A,t.c,tt.c from @t t , (select c  from @t where  c not in (select c from @t  where len(c)=2) and c<>'a')tt  where charindex(t.c ,tt.c)>0  and len(t.c)=2
    实现上面数据格式
            字段1,字段2,在FAS里面去掉重复值就直接可以显示,,,,,
      

  2.   

    用的是ACESS数据库,怎样实现报表打印?
    你上面只是实现查询功能啊