I have two database table, DeviceCatalogue and SkuDetails. DeviceCatalogue has a one to many relationship with SkuDetails, since skudetails is an array. The issue is coming when i'm filtering skudetails based on prices.
for querying the database i'm using following predicate on DeviceCatalogue :
"Any skudetails.priceWithVat >= 1 And Any skudetails.priceWithVat <= 2000"
its basically returning me all the devices under this range. but the issue is that i need only those skudetails which is basically under that filter, but since the relationship in inverse it returning me all the skudetails with this range.
i try to use Subquery also but it is still no solution.
lets take a example of the issue.
IPhone6 <Devices>
- color -> Black , storage -> 64GB , Price 2000 <SkuDetail>
- color -> Black , storage -> 32GB , Price 1800 <SkuDetail>
- color -> White , storage -> 128GB , Price 2800 <SkuDetail>
i only required black 32gb as it is under this range but i'm getting all 3 of them. as im returning devices entity.
should i change my predicate to something else to get my respective result or im doing any thing wrong. or there is fault in overall architecture of database.