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

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

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 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
    )
order by growth
全部评论

相关推荐

点赞 收藏 评论
分享
牛客网
牛客企业服务