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

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

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

select后使用子查询即可

select e.emp_no,
(
    (select s2.salary from salaries s2
where s2.emp_no=e.emp_no and s2.to_date='9999-01-01')
    -
    (select s1.salary from employees e1,salaries s1
where e1.emp_no=s1.emp_no and s1.from_date=e1.hire_date and e1.emp_no=e.emp_no)
    )
as growth
from employees e,salaries s
where e.emp_no=s.emp_no and to_date='9999-01-01'
group by e.emp_no
order by growth
全部评论

相关推荐

12-22 16:31
已编辑
桂林电子科技大学 Python
很奥的前端仔:如果你接了offer 临时又说不去 hr确实要多做一些工作。 当然如果是接offer之前当我没说
点赞 评论 收藏
分享
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务