You can only select grouped filelds
$table = DB::table('tech')
->select('created_at')
->groupBy('created_at')
->get();
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
I'm trying to group my data by date. but I'm getting this error
Syntax error or access violation: 1055 Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'laravel-site.tech.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 `tech` group by `created_at`)
Here is my code
$table = DB::table('tech')
->select('*')
->groupBy('created_at')
->get();
dd($table);
Please or to participate in this conversation.