select t.emp_no,max(t.salary)-min(t2.salary) growth from salaries t left join salaries t2 on t.emp_no = t2.emp_no where t.to_date='9999-01-01' group by t.emp_no order by growth

单表自连接后,where过滤出在职员工,以员工分组 组1 10001 85097 10001 85097 组2 10001 85097 10001 85097

此时在取t表的最大工资和t2表的最小工资之差就是工资的涨幅了