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

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

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

相关推荐

10-24 13:36
门头沟学院 Java
Zzzzoooo:更新:今天下午有hr联系我去不去客户端,拒了
点赞 评论 收藏
分享
评论
点赞
收藏
分享
牛客网
牛客企业服务