Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

paginate problem #64

Open
smilelanss opened this issue Feb 10, 2022 · 2 comments
Open

paginate problem #64

smilelanss opened this issue Feb 10, 2022 · 2 comments

Comments

@smilelanss
Copy link

Hi again @sunel.
Problem pagination
$products = ProductEav::select(['attr.*'])/*->groupBy('rating_attr.value', 'products.id')*/->paginate(20);

solved by adding to the request
groupBy('rating_attr.value', 'products.id')

@smilelanss smilelanss changed the title pagiante problem paginate problem Feb 10, 2022
@sunel
Copy link
Owner

sunel commented Feb 10, 2022

@smilelanss

What is the issue here, sorry i am unable to understand above

@smilelanss
Copy link
Author

$products = ProductEav::select(['attr.'])/->groupBy('rating_attr.value', 'products.id')*/->paginate(20);

I do
$products = ProductEav::select(['attr.*'])->paginate(20);
And I have error

SQLSTATE[42803]: Grouping error: 7 ERROR: column "rating_attr.value" must appear in the GROUP BY clause or be used in an aggregate function LINE 1: ...d" and "rating_attr"."attribute_id" = $1 order by "rating_at... ^ (SQL: select count(*) as aggregate from "products" inner join "product_float" as "rating_attr" on "products"."id" = "rating_attr"."entity_id" and "rating_attr"."attribute_id" = 122 order by "rating_attr"."value" desc)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants