I am trying to make this query working with the sql_mode ONLY_FULL_GROUP_BY instead of disable it as it seems not to be a good practice.
I tried to use ANY_VALUE() function but it is not recognized. I get this error :
[Syntax Error] line 0, col 13: Error: Expected known function, got 'ANY_VALUE'
Here is my query, that is only working if shut off the default sql_mode :
return $this->createQueryBuilder('m')
->select('m.id, m.tutor, m.allow_tester, m.title, g.title as groupTitle, gc.color, COUNT(ms.id) as length')
->leftJoin('m.group_modules', 'gm')
->leftJoin('gm.module_group', 'g')
->leftJoin('g.programs', 'p')
->leftJoin('g.color', 'gc')
->leftJoin('m.steps', 'ms')
->where('p = :p')
->setParameter('p', $program)
->groupBy('m.id')
->orderBy('gm.sorting', 'ASC')
->orderBy('g.id', 'ASC')
->getQuery()
->getResult();
This is a Symfony project working with a MySql 5.7 ovh database.
Any clue ? Thank you !