用WITH ROLLUP将上面的语句改为:
SELECT A,SUM(B),SUM(C)
  FROM TABEL1
  group by a WITH ROLLUP

解决方案 »

  1.   

    插入一表中
    insert into 你的表
    SELECT A,SUM(B),SUM(C)
      FROM TABEL1
      group by a WITH ROLLUP
      

  2.   

    这样行不行?用compute by 还没想到!
    insert into TABEL2 (字段1,字段2,字段3) select A as 字段1,sum(B) as 字段2,sum(C) as 字段3 from TABEL1 group by A order by A
      

  3.   

    如果另外一个表存在的话:
    insert into table2 from select A,sum(B),sum(C) from table1 order by A comoute sum(B),sum(C) by A
    如果另一个表不存在的话:
    select A,sum(B),sum(C) into table2 from table1 order by A comoute sum(B),sum(C) by A
      

  4.   

    insert  table2 select a,sum(b),sum(c) from table1 group by a
    请不要随便说有点难,这里高手大把的(除我以外)
      

  5.   

    select * into 另个表 from (
    select left(a,2) a,sum(b) b,sum(c) c from table1 group by left(a,2)
    union all
    select left(a,4),sum(b),sum(c) from table1 where len(a)>=4 group by left(a,4)
    union all
    select left(a,6),sum(b),sum(c) from table1 where len(a)>=6 group by left(a,6)
    union all
    select left(a,10),sum(b),sum(c) from table1 where len(a)>=10 group by left(a,10)) tem order by a