The Brown Growler
Registered User.
- Local time
- Today, 13:02
- Joined
- May 24, 2008
- Messages
- 85
Hi,
I have 2 tables, T_Purchases and T_Discounts and what I hope to do is to use the [ProductID] and [PurchaseDate] fields from T_Purchases in a query that will lookup a discount rate from the T_Discounts table.
The tables and fields are as below:
T_Purchases
[ProductID],[PurchaseDate]
Sprocket1, 24-Sep-2009
Widget2, 31-May-2010
T_Discounts
[ProductID],[DiscountStartDate],[DiscountEndDate],[DiscountRate]
Sprocket1, 01-Jan-2009, 30-Jun-2009, 22%
Sprocket1, 01-Jul-2009, 31-Dec-2009, 20%
Sprocket1, 01-Jan-2010, 30-Sep-2010, 25%
Widget2, 01-Jan-2009, 30-Jun-2009, 14%
Widget2, 01-Jul-2009, 31-Dec-2009, 16%
Widget2, 01-Jan-2010, 30-Sep-2010, 12%
The query output will hopefullyhave 2 records and look like:
[ProductID],[PurchaseDate],[DiscountRate]
Sprocket1, 24-Sep-2009, 20%
Widget2, 31-May-2010, 12%
Any help most appreciated.
Rgds
Growlos
I have 2 tables, T_Purchases and T_Discounts and what I hope to do is to use the [ProductID] and [PurchaseDate] fields from T_Purchases in a query that will lookup a discount rate from the T_Discounts table.
The tables and fields are as below:
T_Purchases
[ProductID],[PurchaseDate]
Sprocket1, 24-Sep-2009
Widget2, 31-May-2010
T_Discounts
[ProductID],[DiscountStartDate],[DiscountEndDate],[DiscountRate]
Sprocket1, 01-Jan-2009, 30-Jun-2009, 22%
Sprocket1, 01-Jul-2009, 31-Dec-2009, 20%
Sprocket1, 01-Jan-2010, 30-Sep-2010, 25%
Widget2, 01-Jan-2009, 30-Jun-2009, 14%
Widget2, 01-Jul-2009, 31-Dec-2009, 16%
Widget2, 01-Jan-2010, 30-Sep-2010, 12%
The query output will hopefullyhave 2 records and look like:
[ProductID],[PurchaseDate],[DiscountRate]
Sprocket1, 24-Sep-2009, 20%
Widget2, 31-May-2010, 12%
Any help most appreciated.
Rgds
Growlos