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

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

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


# # 入职的薪水表
with a as
(SELECT e.emp_no,s.salary as first_salary
from employees e 
left join salaries s on e.emp_no = s.emp_no
where e.hire_date = s.from_date )

select num,(now_salary - first_salary) as growth 
from 
(select* from a
 LEFT JOIN
 (SELECT e.emp_no as num,s.salary as now_salary
  from employees e 
  left join salaries s on e.emp_no = s.emp_no
  where s.to_date = '9999-01-01')b
 on a.emp_no = b.num
)c
where  num is not null 
and (now_salary - first_salary) is not NULL
order by growth
全部评论

相关推荐

拉丁是我干掉的:把上海理工大学改成北京理工大学。成功率增加200%
点赞 评论 收藏
分享
爱看电影的杨桃allin春招:我感觉你在炫耀
点赞 评论 收藏
分享
评论
点赞
收藏
分享
牛客网
牛客企业服务