title: How to create LEFT JOIN with SELECT subquery using QueryBuilder in Doctrine 2?
body: <p>I need to limit LEFT JOIN results, so I must use subquery.
  Could somebody give me advice how can I do it with Doctrine 2?</p>
  
  <p>What I have now is:</p>
  
  <pre><code>  $qb = $this-&gt;_em-&gt;createQueryBuilder();
      return $qb-&gt;add('select', 'c,j')
               -&gt;add('from', 'JobeetBundle:Category c')
               -&gt;leftJoin('c.jobs', 'j', 'WITH', 'j.category = c')
               -&gt;add('where', 'j.expiresAt &gt; ?1')
               -&gt;add('orderBy','j.expiresAt DESC')
               -&gt;setParameter(1, new \DateTime())
               -&gt;getQuery()
               -&gt;getResult();
  </code></pre>
  
  <p>but I must change it to limit jobs results to 10 by every category.</p>