题解 | #查找在职员工自入职以来的薪水涨幅情况#
查找在职员工自入职以来的薪水涨幅情况
http://www.nowcoder.com/practice/fc7344ece7294b9e98401826b94c6ea5
select distinct emp_no,growth from (select emp_no, LAST_VALUE(salary)over(partition by emp_no order by from_date range between unbounded preceding and UNBOUNDED following)-first_value(salary)over(partition by emp_no order by from_date range between unbounded preceding and UNBOUNDED following) as growth from salaries ) t where (emp_no,'9999-01-01') in (select emp_no,to_date from salaries) order by growth