入职日对应的salary联合1,2表查,当前在职员工的薪水从2表查,减去即为涨薪值
select a.emp_no,b.salary-a.salary growth
from(
select a.emp_no,salary
from employees a,salaries b
where a.emp_no=b.emp_no and a.hire_date=b.from_date
)a,(
select emp_no,salary
from salaries
where to_date='9999-01-01'
)b
where a.emp_no=b.emp_no
order by growth asc

京公网安备 11010502036488号