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

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

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

使用窗口函数,答案正确

select distinct emp_no,(first_value(salary) over w- last_value(salary) over w)as growth
from salaries s
where emp_no in (select distinct emp_no from salaries where to_date='9999-01-01')
WINDOW w as (
partition by emp_no order by to_date desc ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING
);

全部评论

相关推荐

理智的芭乐在查重:这边男朋友还有hc吗
点赞 评论 收藏
分享
Hyh_111:像这种hr就不用管了,基本没啥实力,换一个吧
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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