eav icon indicating copy to clipboard operation
eav copied to clipboard

paginate problem

Open smilelanss opened this issue 4 years ago • 2 comments

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 avatar Feb 10 '22 09:02 smilelanss

@smilelanss

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

sunel avatar Feb 10 '22 11:02 sunel

$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)

smilelanss avatar Feb 16 '22 13:02 smilelanss