title: ORA-00904 invalid identifier for nested select
body: <p>I have been stuck on this error for 2 hours. </p>
  
  <p>I have nested select to get the first value.</p>
  
  <pre><code>select tbl.table_name,
         (select distinct(FirstItem)
         from
             (select first_value(column_name) over (order by timestamp asc rows unbounded predecing) as FirstItem
             from log_table_b l
             where tbl.assignment_no = l.rpt_no)
         ) as "USERNAME",
  from prod_table tbl;
  </code></pre>
  
  <p>It returns this error:</p>
  
  <pre><code>ERROR at line 6:
  ORA-00904: "TBL"."ASSIGNMENT_NO": invalid identifier
  </code></pre>
  
  <p>I have tried many things, none of them seems to be helping me.</p>