分为两张表
一张入职薪资表
一张现在薪资表
再将两者内连接【inner join】起来,组成一张新表
select p.emp_no,q.salary-p.salary as growth from (select a.emp_no,a.salary from salaries a inner join employees b on a.emp_no = b.emp_no where a.from_date = b.hire_date) p --入职表 inner join (select a.emp_no,a.salary from salaries a where a.to_date = '9999-01-01') q --现在表 on p.emp_no = q.emp_no order by growth asc;