Oracle
 sql >> Base de Dados >  >> RDS >> Oracle

Consulta para calcular a SOMA cumulativa e total sobre o salário

SELECT name,
location,
salary,
SUM(salary) OVER ( ORDER BY name) AS running_Salary,
/* order by name can replaced with rownum or rowid , but has to be some
column for perfect ordering as internal order is not judgeable */
SUM(salary) OVER () AS total_salary
FROM yourtable

SQL Fiddle