I'm trying to group joindraw table with count, but getting the following error. How can i get the count and group via multiple columns?
Controller
$joindraw_participants = Joindraw::where('product_id', $id)
->groupBy('user_id', 'created_at')
->with('user')->take(10)->desc()->get();
Error
SQLSTATE[42000]: Syntax error or access violation: 1055 Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'yangmao.joindraw.id' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by (SQL: select * from
joindraw
whereproduct_id
= 1 group byuser_id
order byjoindraw
.created_at
desc limit 10)
from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2HlhEwv
via IFTTT
Aucun commentaire:
Enregistrer un commentaire