日期:2014-05-17 浏览次数:20791 次
With t As ( select 'a' name,'a1' content, 1 numb From dual Union All select 'a' name,'a2' content, 2 numb From dual Union All select 'a' name,'a3' content, 3 numb From dual Union All select 'b' name,'b1' content, 1 numb From dual Union All select 'b' name,'b2' content, 2 numb From dual Union All select 'b' name,'b3' content, 3 numb From dual ) SELECT decode(grouping_id(NAME, content), 3, '合计', 1, '小記', NAME) NAME, content, SUM(numb) numb FROM t GROUP BY ROLLUP(NAME, content);
------解决方案--------------------
顶 2楼
------解决方案--------------------
楼主的意思不是很清楚,你想要什么样的结果,你贴出来啊