题解 | #获取每个部门中当前员工薪水最高的相关信息#
获取员工其当前的薪水比其manager当前薪水还高的相关信息
http://www.nowcoder.com/practice/f858d74a030e48da8e0f69e21be63bef
select * from (select t2.emp_no,t2.manager_no,t2.emp_salary,salaries.salary manager_salary from
(select t1.emp_no,t1.dept_no,t1.manager_no,salaries.salary emp_salary from
(select dept_emp.emp_no,dept_emp.dept_no,dept_manager.emp_no manager_no from dept_emp left outer join dept_manager on dept_emp.dept_no=dept_manager.dept_no) t1
left outer join salaries on t1.emp_no=salaries.emp_no) t2
left outer join salaries on t2.manager_no=salaries.emp_no) t3
where t3.emp_salary>t3.manager_salary
(select t1.emp_no,t1.dept_no,t1.manager_no,salaries.salary emp_salary from
(select dept_emp.emp_no,dept_emp.dept_no,dept_manager.emp_no manager_no from dept_emp left outer join dept_manager on dept_emp.dept_no=dept_manager.dept_no) t1
left outer join salaries on t1.emp_no=salaries.emp_no) t2
left outer join salaries on t2.manager_no=salaries.emp_no) t3
where t3.emp_salary>t3.manager_salary