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

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

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

with tiaojian as (
select 
emp_no
from salaries
where
to_date="9999-01-01"
)

select 
t.emp_no,
sum(t.pt-t.salary) as growth
from(
select 
t.emp_no,
salary,
lead(salary,1)over(partition by t.emp_no order by to_date) as pt
from tiaojian t left join salaries s 
on t.emp_no=s.emp_no
) as t
group by t.emp_no
order by growth

全部评论

相关推荐

下北澤大天使:你是我见过最美的牛客女孩😍
点赞 评论 收藏
分享
评论
1
收藏
分享

创作者周榜

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