title: Zend_Db_Select: LEFT JOIN on a subselect
body: <p>I have a query, that does a <code>LEFT JOIN</code> on a subselect. This query is run in a high load environment and performs within the set requirements. The query (highly simplified) looks like:</p>
  
  <pre><code>SELECT
    table_A.pKey
  , table_A.uKey
  , table_A.aaa
  , table_B.bbb
  , alias_C.ccc
  , alias_C.ddd
  FROM table_A
  INNER JOIN table_B ON table_A.pKey = table_B.pKey
  LEFT JOIN (
  
      SELECT
        table_X.pKey
      , table_X.ccc
      , table_Y.ddd
      FROM table_X
      INNER JOIN table_Y ON table_X.pKey = table_Y.pKey
  
    ) AS alias_C ON table_A.uKey = alias_C.pKey;
  </code></pre>
  
  <p><sup>(for various reasons, it is not possible to rewrite the subselect as a (direct) LEFT JOIN).</sup></p>
  
  <p>Now, I cannot get the <code>LEFT JOIN on subselect</code> to work with <code>Zend_Db_Select</code>. I've tried everything I could come up with, but it does not work.</p>
  
  <p><br/>
  <strong>So my question is:</strong>  </p>
  
  <ul>
  <li>Is it not possible to do a query as described above with  <code>Zend_Db_Select</code>?  </li>
  <li>What syntax do I need to get it to work within Zend Framework?</li>
  </ul>