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

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

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

with temp as
(
select s.*,hire_date
from salaries s
join employees e
on e.emp_no=s.emp_no
),
t as
(
select *
,max(case when from_date=hire_date then salary end) start_sal
,max(case when to_date='9999-01-01' then salary end) end_sal
from temp
group by emp_no
)

select emp_no,end_sal-start_sal as growth
from t
where end_sal is not null
group by emp_no
order by growth

全部评论

相关推荐

去B座二楼砸水泥地:不过也可以理解,这种应该没参加过秋招
点赞 评论 收藏
分享
10-05 23:02
东北大学 Java
我说句实话啊:那时候看三个月培训班视频,随便做个项目背点八股,都能说3 40w是侮辱价
点赞 评论 收藏
分享
点赞 收藏 评论
分享
牛客网
牛客企业服务