-- CUMULATIVE SUM ...
SELECT
TO_CHAR(HIREDATE,'MON-YY') month, SUM(SAL) AS SALARY_AMMOUNT,
SUM(SUM(SAL)) OVER
(ORDER BY TO_CHAR(HIREDATE,'MON-YY') ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW)
AS CUMULATIVE_SALARY_AMMOUNT
FROM SCOTT.EMP
GROUP BY TO_CHAR(HIREDATE,'MON-YY')
ORDER BY TO_CHAR(HIREDATE,'MON-YY') ;
No comments:
Post a Comment