Thursday, 13 March 2014

How to Calculate Running Total in Oracle SQL

Purpose:Get running total Using Analytical Function

select empno,
       ename,
       sal,
       deptno,
       sum(sal) over(partition by null ORDER BY EMPNO RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) Running_Total
  from scott.emp
 order by empno

No comments:

Post a Comment