title: How do I access a LISTAGG that is used in sub query?
body: <p>I have the query below, I am trying to select <strong>inner_query.ship_codes</strong>.</p>
  <p>If I do <strong>inner_query.item_id_alias</strong> it works fine, but how can I select the <strong>ship_codes</strong> from my inner_query ?</p>
  <pre class="lang-sql prettyprint-override"><code>SELECT inner_query.item_id_alias
  FROM (
    SELECT li.item_id as item_id_alias,
           LISTAGG(a.ship_code, '; ')
             WITHIN GROUP (ORDER BY a.ship_code) as &quot;ship_codes&quot;
    FROM (
           SELECT DISTINCT
                  ship_code, 
                  MAX(order_id) as order_id
           FROM   orders o
           WHERE  o.order_id in (
                    SELECT li2.order_id
                    FROM   line_items li2 
                    GROUP BY li2.order_id
                  ) 
           GROUP BY ship_code
         )a
         INNER JOIN line_items li ON a.order_id = li.order_id      
    GROUP BY li.item_id
  ) inner_query;
  </code></pre>