title: how to pass outer query's table in inner query
body: <p>This is my whole query </p>
  
  <pre><code>    SELECT   empmst.emp_id, empmst.emp_name,
           (SELECT RTRIM
                      (XMLAGG (XMLELEMENT (e, d || ',')).EXTRACT ('//text()').EXTRACT
                                                                     ('//text()'),
                       ','
                      )
              FROM (SELECT TO_DATE ('01-04-2012', 'dd-MM-yyyy') - 1
                           + ROWNUM AS d
                      FROM all_objects
                     WHERE TO_DATE ('01-04-2012', 'dd-MM-yyyy') - 1 + ROWNUM &lt;=
                                            TO_DATE ('30-04-2012', 'dd-MM-yyyy')
                    MINUS
                    SELECT tsd.ts_date
                      FROM ts_dtl tsd
                     WHERE empmst.emp_id = tsd.emp_id
                       AND tsd.ts_date BETWEEN TO_DATE ('01-04-2012',
                                                        'dd-MM-yyyy'
                                                       )
                                           AND TO_DATE ('30-04-2012',
                                                        'dd-MM-yyyy'
                                                       ))) AS day11
      FROM emp_mst empmst
     WHERE TSD.EMP_ID=EMPMST.EMP_ID
  ORDER BY empmst.emp_id
  </code></pre>
  
  <p>I want to pass EMPMST.EMP_ID of the outer query to the inner query but inner query does'nt get EMPMST.EMP_ID in the where clause.
  Please tell me how to pass outer query from table to inner query.
  Inner query is as follows</p>
  
  <pre><code>    (SELECT RTRIM
              (XMLAGG (XMLELEMENT (e, d || ',')).EXTRACT ('//text()').EXTRACT
                                                                     ('//text()'),
               ','
              )
     FROM (SELECT TO_DATE ('01-04-2012', 'dd-MM-yyyy') - 1 + ROWNUM AS d
             FROM all_objects
            WHERE TO_DATE ('01-04-2012', 'dd-MM-yyyy') - 1 + ROWNUM &lt;=
                                            TO_DATE ('30-04-2012', 'dd-MM-yyyy')
           MINUS
           SELECT tsd.ts_date
             FROM emp_mst empmst, ts_dtl tsd
            WHERE empmst.emp_id = tsd.emp_id
              AND ts_date BETWEEN TO_DATE ('01-04-2012', 'dd-MM-yyyy')
                              AND TO_DATE ('30-04-2012', 'dd-MM-yyyy')))
  </code></pre>
  
  <p>I want emp_name and emp_id and TS_date where TS_DATE which are not present in TS_DTL of april means the rest of the days of april which are not there in TS_DTL table</p>