SQL Help

Associate
Joined
18 Oct 2002
Posts
724
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 the price range(s) Id for a product, based on the product price.
Code:
[B]t_product[/B]
[I]productId, productName, productCost[/I]
1, Test Prod 1, £5.00
2, Test Prod 2, £10.00
3, Test Prod 3, £15.00

Code:
[B]t_priceRanges[/B]
[B]priceRangeId, fromPrice, toPrice[/B]
1, £0, £10
2, £10, £15
3, £15, £20

In this case, "Test prod 2" has a price of £10.00 and should appear in 2 price Ranges - £0-£10 (price range id = 1) and £10-£15 (price range id = 2).

Any ideas?

Thanks
 
Back
Top Bottom