探索了两种写法,第二种使用了窗口函数
select emp_no,max(salary),(select sum(s2.salary) from salaries s2 where s2.emp_no<=s1.emp_no and s2.to_date='9999-01-01') from salaries s1 where s1.to_date='9999-01-01' group by emp_no

select emp_no,max(salary),sum(salary) over (order by emp_no asc)from salaries where to_date='9999-01-01' group by (emp_no)