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

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

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

全部评论

相关推荐

粗心的雪碧不放弃:纯学历问题,我这几个月也是一直优化自己的简历,后来发现优化到我自己都觉得牛逼的时候,发现面试数量也没有提升,真就纯学历问题
点赞 评论 收藏
分享
点赞 收藏 评论
分享
牛客网
牛客企业服务