select tt.emp_no emp_no,(tt.salary-bb.salary) growth from (select t.salary,t.emp_no from salaries t where to_date='9999-01-01' ) tt inner join (select b.salary,b.emp_no from salaries b inner join employees em on b.emp_no=em.emp_no and b.from_date=em.hire_date) bb on tt.emp_no=bb.emp_no order by growth