题解 | #获取员工其当前的薪水比其manager当前薪水还高的相关信息#
获取员工其当前的薪水比其manager当前薪水还高的相关信息
http://www.nowcoder.com/practice/f858d74a030e48da8e0f69e21be63bef
select a.emp_no,b.emp_no, a.salary, b.salary from (SELECT m.emp_no, m.dept_no, salary from dept_manager m join salaries s on m.emp_no=s.emp_no) b join (SELECT e.emp_no, e.dept_no, salary from dept_emp e JOIN salaries s on e.emp_no=s.emp_no where e.emp_no not in (SELECT emp_no from dept_manager)) a on a.dept_no=b.dept_no where a.salary>b.salary