3 years ago

Laravel's groupBy() not working

Posted 3 years ago by dlook

So I'm trying to get a "top list" from my call log table it has "caller", "callee" and "duration" rows, what I want is to get like top 3 who made most calls in last 24 hours. I tried


But groupBy is returning

SQLSTATE[42000]: Syntax error or access violation: 1055 Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated column which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by

So I guess my question is - is there another way to get that "top X" list from eloquent model? Thanks.

Please sign in or create an account to participate in this conversation.