我想得到结果
日期           类型     数量        类型       数量
 
2001-01-01     a       30            b         50
2001-01-02     a       3             b         60
2001-01-03     a       120           b         70

解决方案 »

  1.   

    只能一条一条的列出再处理啦
    select 类型,Count(物品) from 表1 where 类型='a' and 日期='2002-01-01' UION
    select 类型,Count(物品) from 表1 where 类型='b' and 日期='2002-01-01'
      

  2.   

    select '日期','类型'as TypeA ,sum('数量') as sumA,
                  '' as TypeB,0 as SumA 
                 from Table
    where '类型'='a'
    group by '日期','类型'
    union;
    select '日期', '' as TypeA, 0,as SumA,
           '类型'as TypeB, sum('数量') as sumA from Table
    where '类型'='b'
    group by '日期','类型'再整理後打印.
      

  3.   

    我想你最好建立一个临时Table或View,不是要做每一天的报表吗?这样就容易进行实现了!同样只需一个SQL就行了.