题解 | #获取所有非manager员工当前的薪水情况#
获取员工其当前的薪水比其manager当前薪水还高的相关信息
http://www.nowcoder.com/practice/f858d74a030e48da8e0f69e21be63bef
select a.emp_no,e.emp_no manager_no,b.salary emp_salary,e.salary manager_salary
from dept_emp a
inner join salaries b on a.emp_no=b.emp_no
inner join (
select c.dept_no,d.salary,c.emp_no
from dept_manager c
inner join salaries d on c.emp_no=d.emp_no ) e
on e.dept_no=a.dept_no
where b.salary > e.salary
from dept_emp a
inner join salaries b on a.emp_no=b.emp_no
inner join (
select c.dept_no,d.salary,c.emp_no
from dept_manager c
inner join salaries d on c.emp_no=d.emp_no ) e
on e.dept_no=a.dept_no
where b.salary > e.salary