Flowframe / laravel-trend

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

Syntax error or access violation: 1055 Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated column #11

Closed Cannonb4ll closed 2 years ago

Cannonb4ll commented 2 years ago

Having the following code:

        $data = Trend::model(User::class)
            ->between(now()->subWeek(), now()->endOfDay())
            ->perDay()
            ->count();

Generates the error:

Syntax error or access violation: 1055 Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated column
liamseys commented 2 years ago

I have the same issue.

Umar-Farooq-Shafi commented 1 year ago

Same Issue

Umar-Farooq-Shafi commented 1 year ago

why it's closed without any solution? @Cannonb4ll

rappasoft commented 1 year ago

Why was this closed? I also have the issue.

I'm using this in Filament v3 because they recommend it in their docs.

Edit: It's strange, if I use a column that is not created_at, updated_at, or date. It works. But for this model I want to use created_at and it doesn't allow it.

rappasoft commented 1 year ago

Edit: It's fixed if you set a dateAlias other than date. I just set mine to period.