select t.emp_no, t.manager_no, t.emp_salary, t.manager_salary from (select dp.dept_no, dp.emp_no, dr.emp_no manager_no, ss.salary emp_salary, ss2.salary manager_salary, dp.to_date from dept_emp dp left join dept_manager dr on dp.dept_no = dr.dept_no left join salaries ss on ss.emp_no = dp.emp_no left join salaries ss2 on ss2.emp_no = dr.emp_no) t # 子查询 where t.emp_no != t.manager_no and t.to_date = '9999-01-01' and emp_salary > manager_salary