GUIDO22
Registered User.
- Local time
- Today, 08:33
- Joined
- Nov 2, 2003
- Messages
- 515
I store Sterling / currency exchange rates in my DB which apply between a date range (given as Start / End dates in the currency table : ie. an exchange rate 'period')
So for any one currency type (Euro/Swiss Franc etc.) - there can be many records in the EXCHANGE RATE table, each record covering a date range during which the actual exchange rate value applied).
I need a subquery to return the exchange rate that applies for the exchange rate 'period' during which a customer order was received (WeekIn).
EXCHANGE RATE Table : CurrencyId / Rate / StartDate / EndDate
CUSTOMERS Table : Id / Name / CurrencyId / WeekIn
ORDERS Table : CustomerId / Order / Qty / Price
I am able to return customer orders for a given year but I also need to calculate the Sterling equivalent prices for these orders using the exchange rate that was in place as governed by [WeekIn] date.
Any help gratefully received.
Thank you.
So for any one currency type (Euro/Swiss Franc etc.) - there can be many records in the EXCHANGE RATE table, each record covering a date range during which the actual exchange rate value applied).
I need a subquery to return the exchange rate that applies for the exchange rate 'period' during which a customer order was received (WeekIn).
EXCHANGE RATE Table : CurrencyId / Rate / StartDate / EndDate
CUSTOMERS Table : Id / Name / CurrencyId / WeekIn
ORDERS Table : CustomerId / Order / Qty / Price
I am able to return customer orders for a given year but I also need to calculate the Sterling equivalent prices for these orders using the exchange rate that was in place as governed by [WeekIn] date.
Any help gratefully received.
Thank you.