题解 | #查找在职员工自入职以来的薪水涨幅情况#
查找在职员工自入职以来的薪水涨幅情况
http://www.nowcoder.com/practice/fc7344ece7294b9e98401826b94c6ea5
先找到雇佣起始的工资
select*
from employees as e join salaries as s on e.emp_no = s.emp_no
where e.hire_date = s.from_date
将此列表和新水表连接
select c.emp_no, (s.salary-c.salary) growth
from salaries as s join (
select*
from employees as e join salaries as s on e.emp_no = s.emp_no
where e.hire_date = s.from_date ) as c on s.emp_no = c.emp_no
where s.to_date='9999-01-01'
order by growth