Hi
I have a number of products that have been assigned a price (field type of currency) and I'm trying to categorise these products into price ranges.
I'm trying to build an SQL query that will return all the products in a particular price range, when only passing in a priceRangeId.
t_product
productId, productName, productCost
1, Test Prod 1, £5.00
2, Test Prod 2, £10.00
3, Test Prod 3, £15.00
t_priceRanges
priceRangeId, fromPrice, toPrice
1, £0, £10
2, £10, £15
3, £15, £20
If i pass in a price range ID of 2, I only expect to see "test prod 2" and "test prod 3" in the products results since their product prices are in the £10-£15 range.
Any ideas?
Thanks
I have a number of products that have been assigned a price (field type of currency) and I'm trying to categorise these products into price ranges.
I'm trying to build an SQL query that will return all the products in a particular price range, when only passing in a priceRangeId.
t_product
productId, productName, productCost
1, Test Prod 1, £5.00
2, Test Prod 2, £10.00
3, Test Prod 3, £15.00
t_priceRanges
priceRangeId, fromPrice, toPrice
1, £0, £10
2, £10, £15
3, £15, £20
If i pass in a price range ID of 2, I only expect to see "test prod 2" and "test prod 3" in the products results since their product prices are in the £10-£15 range.
Any ideas?
Thanks
Last edited: