MySQL query using the 'GROUP BY' clause

What @pascal.fragnoud said. If your SQL is set to sql_mode=only_full_group_by then every column that is not using an aggregate function has to in your GROUP BY clause.

More info - sql - Error related to only_full_group_by when executing a query in MySql - Stack Overflow

Seems that you may have already seen this thread though given your attempt to try to change the sql mode. I would just fix the query though instead of changing the mode. It may be a little annoying and more verbose but it will also be more explicit about what is being done. If you truly don't care about what the value of a certain column is in when grouped, there is the ANY_VALUE() function.

1 Like