Group by not working - Laravel Group by not working - Laravel laravel laravel

Group by not working - Laravel


Edit your applications's database config file config/database.php

In mysql array, set strict => false to disable MySQL's strict mode


Maybe your issue is due to the fact that you are using a MySQL server vith version 5.7.5+. From this version on the way GROUP BY works is changed since they make it behave in order to be SQL99 compliant (where in previous versions it was not).

Try to do a full group by or change the configuration of your MySQL server.

Link to official MySQL doc where full GROUP BY is explanined


Go to config/database.php

Update strict value false.

return [   'connections' => [      'mysql' => [         'strict' => false       ]   ]]