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

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

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

union all 改成union也行 select emp_no,max(s1)-min(s1) growth from( select emp_no,salary s1 from salaries where from_date in(select distinct min(from_date) from salaries group by emp_no) and emp_no in(select emp_no from salaries where to_date ='9999-01-01') union all select emp_no,salary s2 from salaries where to_date ='9999-01-01' )as AB group by emp_no

order by growth asc

全部评论

相关推荐

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