M
Matthew
Hi,
I'm trying to find a value in table F (Foreign Exchange Rate) that is the
closest to the date I purchased a product specified in table P, so that I can
convert the purchase price into US $ from a foreign currency
So here's a simplified table structures:
F
Key Currency FDate ExchangeRate
1 RMP 1/1/2008 1.111
2 RMP 1/3/2008 1.122
3 CAD 1/1/2008 0.999
4 CAD 1/2/2008 0.998
P
Key Currency PDate PriceLocalCurrency
1 RMP 1/1/2008 10.00
2 RMP 1/2/2008 11.00
Finding the correct value (ExchangeRate) in Table F for the first record
(Key=1) in Table P is trivial. But how do I find ExchangeRate in Table F for
the second record (e.g., where the dates in the two tables don't match).
I'm okay matching on either the previous date (1/1/2008 in this case) or the
next date (1/3/2008).
Thanks,
Matthew
I'm trying to find a value in table F (Foreign Exchange Rate) that is the
closest to the date I purchased a product specified in table P, so that I can
convert the purchase price into US $ from a foreign currency
So here's a simplified table structures:
F
Key Currency FDate ExchangeRate
1 RMP 1/1/2008 1.111
2 RMP 1/3/2008 1.122
3 CAD 1/1/2008 0.999
4 CAD 1/2/2008 0.998
P
Key Currency PDate PriceLocalCurrency
1 RMP 1/1/2008 10.00
2 RMP 1/2/2008 11.00
Finding the correct value (ExchangeRate) in Table F for the first record
(Key=1) in Table P is trivial. But how do I find ExchangeRate in Table F for
the second record (e.g., where the dates in the two tables don't match).
I'm okay matching on either the previous date (1/1/2008 in this case) or the
next date (1/3/2008).
Thanks,
Matthew