title: Not able to adress field in nested query
body: <p>I have such a query:</p>
  
  <pre><code>select d.r_object_id,
  
      (select max(max_date) from (
  
          SELECT max(sys_s.r_modify_date) AS max_date
          FROM kc_mission_s mis_s, dm_sysobject_s sys_s
          WHERE mis_s.r_object_id = sys_s.r_object_id AND mis_s.ka_document = d.r_object_id
  
          union all
  
          SELECT sys_s.r_modify_date AS max_date
          FROM dm_document_s doc_s left join dm_sysobject_s sys_s on doc_s.r_object_id = sys_s.r_object_id
          WHERE doc_s.r_object_id = d.r_object_id
  
      )) as maxx
  
  from kc_document_s d
  </code></pre>
  
  <p>The field <code>d.r_object_id</code> is not visible from the last nested query.
  It will be visible if in-between query will be removed like this:</p>
  
  <pre><code>select d.r_object_id,
  
      (
          SELECT max(sys_s.r_modify_date) AS max_date
          FROM kc_mission_s mis_s, dm_sysobject_s sys_s
          WHERE mis_s.r_object_id = sys_s.r_object_id AND mis_s.ka_document = d.r_object_id
  
          union all
  
          SELECT sys_s.r_modify_date AS max_date
          FROM dm_document_s doc_s left join dm_sysobject_s sys_s on doc_s.r_object_id = sys_s.r_object_id
          WHERE doc_s.r_object_id = d.r_object_id
  
      ) as maxx
  
  from kc_document_s d
  </code></pre>
  
  <p>But in this case I'm not allowed to select multiple rows.
  What should I do?</p>