title: Doctrine QueryBuilder - multiple select fields
body: <p>I have a strange problem with multiple select fields.
  This is my query:</p>
  
  <pre><code>$query = $queryBuilder
              -&gt;select(
                  [
                      'SUM(t1.quantity) AS quantity_t1',
                      't2.currency AS currency_t2',
                      'SUM(t1.amount - t1.promotionDiscount) AS amount_t1',
                      'SUM(ROUND((t1.amount - t1.promotionDiscount) / ((100 + t2.tax) / 100), 2)) AS amount_net',
                      'SUM(ROUND((t1.amount - t1.promotionDiscount) / '.EXCHANGE_RATE_GBP.', 2)) AS amount_gbp',
                      'SUM(ROUND(ROUND((t1.amount - t1.promotionDiscount) / '.EXCHANGE_RATE_GBP.', 2) / ((100 + t2.tax) / 100), 2)) AS amount_gbp_net'
                  ]
              )
              -&gt;from(Sale::class, 't2')
              -&gt;join(
                  SaleRow::class,
                  't1',
                  Join::WITH,
                  $queryBuilder-&gt;expr()-&gt;andX(
                      $queryBuilder-&gt;expr()-&gt;eq('t1.saleId', 't2.id')
                  )
              )
              -&gt;where(
                  $queryBuilder-&gt;expr()-&gt;between('t2.purchaseTime', ':start', ':end')
              )
              -&gt;andWhere(
                  $queryBuilder-&gt;expr()-&gt;in('t2.orderStatus', ':status')
              )
              -&gt;setParameters(
                  [
                      ':start' =&gt; $startDate-&gt;format('Y-m-d H:i:s'),
                      ':end' =&gt; $endDate-&gt;format('Y-m-d H:i:s'),
                      ':status' =&gt; ['pending', 'shipped']
                  ]
              )
              -&gt;getQuery();
  
          $results = $query-&gt;getArrayResult();
  </code></pre>
  
  <p>The query works, but only If I change my select array:</p>
  
  <p>For example like this:</p>
  
  <pre><code>-&gt;select(
      [
         't1.id',
         't2.id'
      ]
   )
  </code></pre>
  
  <p>And very strange...
  This works:</p>
  
  <pre><code>-&gt;select(
      [
          'SUM(t1.quantity) AS quantity_t1',
          'SUM(t1.amount - t1.promotionDiscount) AS amount_t1'
      ]
  )
  </code></pre>
  
  <p>And this too:</p>
  
  <pre><code>-&gt;select(
      [
          't2.currency AS currency_t2',
      ]
  )
  </code></pre>
  
  <p>But .. this does not work:</p>
  
  <pre><code>-&gt;select(
      [
          'SUM(t1.quantity) AS quantity_t1',
          't2.currency AS currency_t2',
      ]
  )
  </code></pre>
  
  <p>Why?</p>