select t1.emp_no as emp_no, t2.emp_no as manager_no, 
t1.salary as emp_salary, t2.salary as manager_salary
from
(select d_e.emp_no, s1.salary, d_e.dept_no
from dept_emp d_e left join salaries s1
on d_e.emp_no = s1.emp_no
where d_e.to_date = '9999-01-01' and s1.to_date = '9999-01-01') t1
left join
(select d_m.emp_no, s2.salary, d_m.dept_no
from dept_manager d_m left join salaries s2
on d_m.emp_no = s2.emp_no
where d_m.to_date = '9999-01-01' and s2.to_date = '9999-01-01') t2
on t1.dept_no = t2.dept_no
where t1.emp_no != t2.emp_no and t1.salary > t2.salary