显示薪水低于其经理但超过使用ORACLE SQL查询的任何其他经理的薪水的员工
答案 0 :(得分:0)
WITH mgr_salaries ( empno, ename, esal, mgr, mgr_salary ) AS (
SELECT empno,
ename,
salary,
mgr,
PRIOR salary
FROM Employees
START WITH mgr IS NULL
CONNECT BY PRIOR empno = mgr
)
SELECT *
FROM mgr_salaries
WHERE salary < mgr_salary
AND NOT EXISTS (
SELECT 1
FROM mgr_salaries x
WHERE x.mgr <> m.mgr
AND x.mgr_salary > m.salary
);