Flowframe / laravel-trend

Generate trends for your models. Easily generate charts or reports.
MIT License
720 stars 74 forks source link

GroupBy styntax violation error #61

Closed alkadoHs closed 6 months ago

alkadoHs commented 6 months ago

I have these codes that read Orders per day for the week: Screenshot from 2024-03-21 19-34-06

But, I'm getting 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 'mauzodata.orders.created_at' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by

select date_format(created_at, '%Y-%m-%d') as date, sum(paid) as aggregate from orders where created_at between 2024 -03 -18 00: 00: 00 and 2024 -03 -24 23: 59: 59 group by date order by date asc**

tjodalv commented 6 months ago

Disable only_full_group_by mode in your MySQL server

SET GLOBAL sql_mode=(SELECT REPLACE(@@sql_mode,'ONLY_FULL_GROUP_BY',''));
alkadoHs commented 6 months ago

Thank for your response. I got the answer, it was because of the conflict on my orders table, it contains date column and created_at column. But after deleting date column now it works fine.