Reputation: 21
I need a flexible query to get all PriceRowModel with at least 2 same prices in the same base store. It's that possible or I need a groovy script for select them?
Upvotes: 1
Views: 291
Reputation: 780
For this query worked :
SELECT {p.PK} FROM {PriceRow as p JOIN CatalogVersion as cv on {p.catalogversion}={cv.PK} JOIN Catalog as c on {cv.catalog}={c.PK} JOIN CatalogsForBaseStores as rel ON {c.PK}={rel.target} JOIN BaseStore as bs ON {rel.source}={bs.PK}} where {bs.uid}='my_store' AND {p.price} IN ({{SELECT {price} FROM {PriceRow} group by ({price}) having count({price}) > 1}} )
Upvotes: 0