Yes, i tried using "$groupByClause[] = $selectExpressions->fieldIdentificationVariable;" first but that didn't work. But i do recognize that this PR breaks all other aggregate functions (my reasoning was that Doctrine would be smart enough to filter out doubles). 

Is there a way to just get all the fieldnames that are in the select-query, regardless of their usage inside aggregate functions?