Level 75
1 like
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
i try to get articles, and some articles have dublicated title i want to groub by title
$articles=Article::select(
'id',
'img',
'created_at',
'title_ar',
)->groupBy('title_ar')->limit(6)->get();
but i got this error
SQLSTATE[42000]: Syntax error or access violation: 1055 Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'mhpss.articles.id' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by (SQL: select `id`, `img`, `created_at`, `title_ar` from `articles` group by `title_ar` limit 6)
Please or to participate in this conversation.