我需要一个灵活的查询来获取同一基本商店中至少有两个相同价格的所有PriceRowModel。这是可能的,还是我需要一个groovy脚本来选择它们?
对于此查询有效:
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}} )