GROUP_CONCAT sort and separator in QueryBuilder?


#1

Hi!

I’m trying to use GROUP_CONCAT in my query to list a number of activities:

$query->select([
‘name’ => ‘lastname’,
‘activities’ => ‘GROUP_CONCAT(DISTINCT(activities))’
]);

This works fine, but as soon as I want to sort the activities and add another separator, I get an error:

Column not found: 1054 Unknown column 'DISTINCT("activities") SEPARATOR ", "' in 'field list'

Sadly I couldn’t find anything helpful in the documentation, is there a clever way to do this?

Thanks in advance!