题解 | #查找在职员工自入职以来的薪水涨幅情况#
查找在职员工自入职以来的薪水涨幅情况
https://www.nowcoder.com/practice/fc7344ece7294b9e98401826b94c6ea5
select t1.emp_no, sum(t2.salary-t1.salary) from salaries as t1 left join salaries as t2 on t1.emp_no=t2.emp_no and t1.to_date=t2.from_date where t2.to_date is not null and t1.emp_no in (select emp_no from salaries where to_date='9999-01-01') group by t1.emp_no order by sum(t2.salary-t1.salary);