title: Symfony Doctrine: Use of subquery with "HAVING" clause without using EXISTS
body: <p>In a Symfony project I'm trying to make a query with a calculated field. Simplify a lot my SQL would be something like that:</p>
  
  <pre><code>SELECT o.id, (p.price_a + p.price_b) as total_price
  FROM objects o
  INNER JOIN prices p
  ON o.id = p.object_id
  HAVING total_price &gt; 10
  </code></pre>
  
  <p>My calculated field is more complex and use external values that change and I cannot pre-calculate it.</p>
  
  <p>As I want only the distinct object.id I've added the upper code as a subquery:</p>
  
  <pre><code>SELECT DISTINCT o_id 
  FROM (
    SELECT o.id as o_id, (p.price_a + p.price_b) as total_price
    FROM object o
    INNER JOIN price p
    ON o.id = p.object_id
    HAVING total_price &gt; 10)
  </code></pre>
  
  <p>In Symfony I want that this query returns only the distinct "Object"s. </p>
  
  <p>I've tried many options with query builder but I cannot add a subquery to the "FROM" clause.</p>
  
  <p>I'm tryng to avoid using the inefficient EXISTS clause:</p>
  
  <pre><code>SELECT DISTINCT o.id 
  FROM objects o
  WHERE EXISTS (
    SELECT p.*, (p.price_a + p.price_b) as total_price
    FROM prices p
    WHERE o.id = p.object_id
    HAVING total_price &gt; 10)
  </code></pre>
  
  <p>Is there any way to do this with Query Builder without using "EXISTS"?</p>