我试图获得每个部门的前 3 名最高薪水,但是在 q.salary 的代码末尾我收到以下错误:ORA-00904: "Q"."SALARY": invalid identifier
这是我的代码
with query as (
select max(salary), department_id
from employees
group by department_id
)
SELECT ROWNUM as RANK,
e.last_name,
e.salary
FROM (
select department_id, salary
from employees e,
query q
where e.salary = q.salary
)
where rownums <=3
先感谢您