日期:2014-05-18 浏览次数:20840 次
select f1,sum(f2) f2,sum(f3) f3 from table group by f1 with rollup
------解决方案--------------------
select f1,sum(f2) f2,sum(f3) f3
from table group by f1
union
select '合计' as f1, sum(f2),sum(f3) from (select f1,sum(f2) f2,sum(f3) f3
from table group by f1)a group by f1
------解决方案--------------------
select f1,sum(f2) f2,sum(f3) f3 from table group by f1 union all select f1='合计',sum(f2) f2,sum(f3) f3 from table