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

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

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

with t2 as(
select 
    s1.emp_no,
    case when s1.to_date = '9999-01-01' then s1.salary else null end as new1,
    start_salary
from salaries s1
join (
select 
    s.emp_no,
    s.salary as start_salary,
    s1.salary as new_salary,
    s.from_date,
    s1.to_date,
    rank() over(partition by emp_no order by from_date) as ranking
from salaries s
left join salaries s1 on s.to_date = s1. from_date and s.emp_no = s1.emp_no   
) t1 on s1.emp_no = t1.emp_no and ranking = 1
)
select 
    emp_no,
    new1 - start_salary as growth
from t2
where new1 is not null 
order by growth

全部评论

相关推荐

26届双非不知道咋找得到实习了
kong_kong:1.广投,boss每天200次机会用完, 2.简历上技能和项目经历突出你在这个岗位上的突出优势。 3.还是广投,不要挑地点,公司规模(我当时是线下一个都不去,如果你离得近可以考虑一下去现场) 4.简历写的自己成绩好什么的,奖项也写一写(懂的都懂)
点赞 评论 收藏
分享
04-15 23:42
中山大学 Java
ResourceUtilization:过几天楼主就会捧着一堆offer来问牛友们该怎么选辣
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客企业服务