题解 | #查找在职员工自入职以来的薪水涨幅情况#
查找在职员工自入职以来的薪水涨幅情况
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