Tomás Pizarro
Tomás Pizarro

Reputation: 21

How can I get all PriceRow there are 2 at least with the same prices in the same baseStore in flexible query

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

Answers (1)

Roman Lototskyi
Roman Lototskyi

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

Related Questions