oracle 中 group by 加强
group by rollup(a,b)
=
group by a,b
+
group by a
+
group by null
1 SQL> select deptno,job,sum(sal) 2 2 from emp 3 3 group by rollup(deptno,job); 4 5 DEPTNO JOB SUM(SAL) 6 ------ --------- ---------- 7 2000 8 2000 9 10 CLERK 1400 10 10 MANAGER 2450 11 10 PRESIDENT 5000 12 10 8850 13 20 CLERK 800 14 20 ANALYST 3000 15 20 MANAGER 2975 16 20 6775 17 30 CLERK 950 18 30 MANAGER 2850 19 30 SALESMAN 5600 20 30 9400 21 27025 22 23 15 rows selected
郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。