Cumulative Sum or Running Total in SQL

Query to obtain cumulative sum or running total from employee table for salary column.

     select Employee_id, Salary,
     SUM(Salary) OVER (ORDER BY Employee_id) 
     As RunningTotal
     from employee;

Facebook Comments

Leave a Reply

Your email address will not be published. Required fields are marked *