题解 | #获取员工其当前的薪水比其manager当前薪水还高的相关信息#
获取员工其当前的薪水比其manager当前薪水还高的相关信息
http://www.nowcoder.com/practice/f858d74a030e48da8e0f69e21be63bef
select de.emp_no ,dm.emp_no as manager_no, salary AS emp_salary,
(select salary from salaries where emp_no = dm.emp_no) as manager_salary
from dept_emp de
JOIN salaries sa USING(emp_no)
JOIN dept_manager dm USING(dept_no)
where sa.salary> (select salary from salaries where emp_no = dm.emp_no)
and de.emp_no not in (select emp_no from dept_manager)