select A.*,B.dept_no from salaries A,dept_manager B where A.emp_no=B.emp_no and A.to_date='9999-01-01' AND B.to_date='9999-01-01' order by A.emp_no