GJT
Registered User.
- Local time
- Today, 21:26
- Joined
- Nov 5, 2002
- Messages
- 116
I have these two tables in a 1:M relationship.
One called CURRENCY and the other CURRENCY_HISTORY containing the exchange rates and the dates on which the revised rates are added to the table, respectively.
Problem I have is this :
For 'n' orders during the year, the exchange rates change (obv) . I need to write a query to return the appropriate GBP order value for all orders in that year in accordance with their exchange rate values. The corresponding rate that is used for each order will depend of course upon the CURRENCY ID (currency type) and the order date.
i.e.
USD rates in CURRENCY_HISTORY
10/1/2002 = 1.5
22/4/2002 = 1.6
16/10/2002 = 1.7
18/12/2002 = 1.8
if the order date was 10/5/2002, the USD rate to use would be 1.6 i.e between 22/4/2002 & 16/10/2002.
Does anyone know if this can be done relatively easily??
Thanks
One called CURRENCY and the other CURRENCY_HISTORY containing the exchange rates and the dates on which the revised rates are added to the table, respectively.
Problem I have is this :
For 'n' orders during the year, the exchange rates change (obv) . I need to write a query to return the appropriate GBP order value for all orders in that year in accordance with their exchange rate values. The corresponding rate that is used for each order will depend of course upon the CURRENCY ID (currency type) and the order date.
i.e.
USD rates in CURRENCY_HISTORY
10/1/2002 = 1.5
22/4/2002 = 1.6
16/10/2002 = 1.7
18/12/2002 = 1.8
if the order date was 10/5/2002, the USD rate to use would be 1.6 i.e between 22/4/2002 & 16/10/2002.
Does anyone know if this can be done relatively easily??
Thanks