I would like to ask you for help with getting previous currency rate.
Eg. I have two tables (Orders
and CurrencyRates
) which I want to join. First table encloses orders in EUR, and second encloses currency rate from EUR to USD.
I would like to join it by Order Date. The problem is with order date "10.11.2018" which has null rate from CurrencyRates
table. I would like to have here value from previous day rate (in this case "09.11.2018). And for the future date ("18.11.2018") I would like to have value having max(Date) from CurrencyRates
table. Is there any way to join it to have expected values?
Thank you for your help!