WITH test AS
(
SELECT '58000' deptno, 10000000 sal FROM dual
UNION ALL SELECT '59000', 20000000 FROM dual
UNION ALL SELECT '57000', 20120000 FROM dual
)
SELECT DECODE(GROUPING(1),0,deptno) deptno
, DECODE(GROUPING(1),0,SUM(sal),SUM(SUM(sal)) OVER(ORDER BY ROWNUM)/2) sal
FROM test
GROUP BY ROLLUP(1), ROWNUM, deptno
;
GROUPING(1) -> 에 대한 의미가 무엇입니까??
ROLLUP(1) -> 에 숫자와 같지 않으면 안되던데