题解 | #查找在职员工自入职以来的薪水涨幅情况#

查找在职员工自入职以来的薪水涨幅情况

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
全部评论

相关推荐

去B座二楼砸水泥地:不过也可以理解,这种应该没参加过秋招
点赞 评论 收藏
分享
点赞 收藏 评论
分享
牛客网
牛客企业服务