题解 | #SQL21 寻找在职员工自入职以来的薪水涨幅情况#
查找在职员工自入职以来的薪水涨幅情况
http://www.nowcoder.com/practice/fc7344ece7294b9e98401826b94c6ea5
在职: 规定 to_date = '9999-01-01'
入职:对照员工表的 hire_date
涨幅:最近一次 - 入职时的薪水
select es.emp_no, (ss2.sl2-ss.salary) as growth from employees es left join salaries ss on es.emp_no = ss.emp_no and es.hire_date = ss.from_date join (select emp_no, salary sl2 from salaries where to_date = '9999-01-01') ss2 on es.emp_no = ss2.emp_no order by growth