id name month salary
e001 manish 1 10000
e001 manish 2 20000
e001 manish 3 30000
e002 rohit 1 30000
输出应该如下所示
id name month salary cumsalary
e001 manish 1 10000 10000
e001 manish 2 20000 30000
e001 manish 3 30000 60000
e002 rohit 1 30000 30000
sql:
select t1.* ,
sum(salary) over (partition by id order by id) cumsalary
from table t1