题解 统计salary的累计和running_total
统计salary的累计和running_total
https://www.nowcoder.com/practice/58824cd644ea47d7b2b670c506a159a6
尝试使用自连接解题
select s2.emp_no, s2.salary, sum(s1.salary) as running_total from salaries s1, salaries s2 --笛卡尔积 where s2.to_date = '9999-01-01' and s1.to_date = '9999-01-01'--筛选出当前员工 and s2.emp_no >= s1.emp_no --筛选可累计的员工 group by s2.emp_no,s2.salary->->