-- 法1:聚合窗口函数
select emp_no, salary,
sum(salary)over(order by emp_no) as running_total
from salaries
where to_date = '9999-01-01'
-- 法2:自连接+group by
select a.emp_no, a.salary, sum(b.salary)
from salaries as a, salaries as b
where a.emp_no >= b.emp_no
and a.to_date = '9999-01-01'
and b.to_date = '9999-01-01'
group by a.emp_no
order by a.emp_no