题解 | #员工比其manager当前薪水还高的相关信息#
获取员工其当前的薪水比其manager当前薪水还高的相关信息
https://www.nowcoder.com/practice/f858d74a030e48da8e0f69e21be63bef
select a1.emp_no, a1.manager_no, a2.emp_salary, a3.manager_salary from ( select t1.emp_no, t2.emp_no manager_no from dept_emp t1 inner join dept_manager t2 on t1.dept_no = t2.dept_no where t1.emp_no != t2.emp_no ) a1 inner join ( select emp_no, salary emp_salary from salaries where to_date = '9999-01-01' ) a2 on a1.emp_no = a2.emp_no inner join ( select emp_no, salary manager_salary from salaries where to_date = '9999-01-01' ) a3 on a1.manager_no = a3.emp_no where a2.emp_salary > a3.manager_salary;