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

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

http://www.nowcoder.com/practice/fc7344ece7294b9e98401826b94c6ea5

SELECT f.emp_no, (t.salary - f.salary) growth

from 

(SELECT s.emp_no, s.salary from employees e 
inner JOIN salaries s ON e.emp_no = s.emp_no and e.hire_date = s.from_date) f

INNER JOIN

(SELECT s.emp_no, s.salary from employees e 
INNER JOIN salaries s ON e.emp_no = s.emp_no and s.to_date = '9999-01-01') t

ON f.emp_no = t.emp_no

ORDER BY growth;
全部评论

相关推荐

点赞 评论 收藏
分享
点赞 收藏 评论
分享
牛客网
牛客企业服务