我创建了以下选择:
select e.first_name, e.last_name,
(select jobname_id from
(select j.id, j.jobname_id, first_value(j.jobname_id)
over (order by j.date_from desc) as current_job
from jobs j where j.emp_id=e.emp_id and j.date_from < sysdate)
where jobname_id != current_job and rownum=1) as previous_job
from employees e
但我得到“ORA-00904:“E”。“EMP_ID”:无效标识符”
如何在子查询中使用对 E.EMP_ID 的引用?