代码是
SELECT DEPTNO,JOB ,SUM(SAL)
FROM EMP
GROUP BY ROLLUP(DEPTNO,JOB );
怎么用字符“ALL JOB”代替job列的NULL值?
SELECT DEPTNO,nvl(JOB,'ALL JOB') job ,SUM(SAL)
FROM EMP
GROUP BY ROLLUP(DEPTNO,JOB );
应该有个grouping 关键字 判断是不是正在对当前字段汇总.
case when grouping(deptno)=1 then '汇总' end
grouping应该可以的. 试下