SELECT MONTH, SUM(TOT_SALES) CR_SUM, SUM(SUM(TOT_SALES)) OVER(ORDER BY MONTH ASC ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) 누적금액 FROM ORDERS WHERE YEAR = 2001 GROUP BY MONTH ORDER BY MONTH
총합계는 위의 긴 부분이 아래와 같이 조금 수정된다.
SELECT MONTH, SUM(TOT_SALES) CR_SUM, SUM(SUM(TOT_SALES)) OVER(ORDER BY MONTH ASC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) 누적금액 FROM ORDERS WHERE YEAR = 2001 GROUP BY MONTH ORDER BY MONTH
바로 앞, 뒤의 값을 더하는 것은
1 PRECEDING AND 1 FOLLOWING 으로 하면 된다.