title: groupBy using alias in Doctrine QueryBuilder
body: <p>I'm trying to query a database to get all initials from a table. In SQL, the query would be:</p>
  
  <pre><code>SELECT SUBSTRING(t.name, 1, 1) AS initial FROM Tool t GROUP BY initial
  </code></pre>
  
  <p>But using QueryBuilder, I haven't found the way to group by aliases. I've tried:</p>
  
  <pre><code> $q = $this-&gt;em-&gt;createQueryBuilder()
       -&gt;select('SUBSTRING(i.name, 1, 1) AS initial')
       -&gt;from('...\Entity\Tool', 't')
       -&gt;groupBy('initial');
  
  Error: 'initial' does not point to a Class.
  
  $q = $this-&gt;em-&gt;createQueryBuilder()
       -&gt;select('SUBSTRING(t.name, 1, 1)')
       -&gt;from('...\Entity\Tool', 't')
       -&gt;groupBy('SUBSTRING(t.name, 1, 1)');
  
  (t.name, 1, ': Error: Cannot group by undefined identification variable.
  </code></pre>
  
  <p>And after half an hour of looking for documentation I'm asking again for help. Is it possible, or should I go to another way ?</p>