My laravel eloquent is like this :
$products = Product::where('status', 1)
->where('stock', '>', 0)
->where('category_id', '=', $category_id)
->groupBy('store_id')
->orderBy('updated_at', 'desc')
->take(4)
->get();
When executed, there exist error like this :
SQLSTATE[42000]: Syntax error or access violation: 1055 Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'myshop.products.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
productswherestatus= 1 andstock> 0 andcategory_id= 5 group bystore_idorder byupdated_atdesc limit 4)
How can I solve it?
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire