I am getting the error while executing below, while without groupBy it is working fine.
User::select('col')->groupBy('col1')->chunk(100, function ($users) { foreach ($users as $user) { dump($user); } });
Error:
SQLSTATE[42000]: Syntax error or access violation: 1055 Expression #1 of ORDER BY clause is not in GROUP BY clause and contains nonaggregated column