Database/Oracle

Oracle 함수 - Grouping Sets

xProgrammer 2018. 3. 19. 11:24

스키마

http://xprogrammer.tistory.com/333


쿼리
SELECT deptno, job, SUM(sal)
FROM emp
GROUP BY GROUPING SETS(deptno, job);

- GROUPING SETS 함수의 결과는 각 그룹 조건에 대해 별도로 GROUP BY한 결과를 UNION ALL한 결과와 동일함


결과


테스트

http://sqlfiddle.com