title: ORACLE: ORA-00904: : invalid identifier
body: <p>I have created following select:</p>
  
  <pre class="lang-sql prettyprint-override"><code>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 &lt; sysdate) 
      where jobname_id != current_job and rownum=1) as previous_job 
  from employees e
  </code></pre>
  
  <p>but I get "ORA-00904: "E"."EMP_ID": invalid identifier"</p>
  
  <p>how can I use the reference to E.EMP_ID in the subquery?</p>