I have a table with transactions with different currencies, and some of these dates fall on a weekend or holiday. Example:
Date currency_code ammount
20-02-2017 EUR 55
18-02-2017 GBP 33
17-02-2017 EUR 44.55
An example of what my Currency
table looks like:
SELECT rate,date, currency_code FROM exchangeTable:
rate Date currency_code
53,35 13-02-2017 ADP
53,35 14-02-2017 ADP
182,4 16-02-2017 ADP
192,45 17-02-2017 ADP
191,31 20-02-2017 ADP
Is there a simple subquery I can use in my join statement which will join the most recent currency date onto my transaction date, if it falls on a weekend or holiday? I think I should use a partition here, but don't have much experience with them.
left join (?????????) a on a.date = b.date and a.currency_code= b.currency_code