troubleshooting Question

GET THE RIGHT EXCHANGE RATE FROM TABLE

Avatar of emi_sastra
emi_sastra asked on
Microsoft SQL Server 2005Microsoft SQL Server 2008
40 Comments1 Solution453 ViewsLast Modified:
Hi All,

I have transaction table and a exchange rate table.

I. TableA
   1. TrsId
   2. TrsDate
   3. CurcyCode

II. TableB
    1. CurcyCode
    2. ExchangeDate
    3. ExchangeRate

My problem is how to get the right exchange rate for every transaction ?

Scenario :

1. If TrsDate  = ExchangeDate  then get the ExchangeRate.
2. If TrsDate > ExchangeDate  then get the latest ExchangeDate before the TrsDate's  ExchangeRate.

How could I do it ?

Thank you.
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 40 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 40 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros