I have a table that store loan records and I need to compare today's data with yesterday's. The problem is, my company didn't process and store any data on Sunday or public holiday, so every Monday or the day after public holiday data always be NULL.
My table looks like this
LOAN_DATE | YSTR_DATE | ACC_NO | BALANCE | LOAN_ID
2022-01-07 | null | 5000093X| -619294125.98 | LO1
2022-01-07 | null | 1079653X| -650000000.00 | LO2
2022-01-08 | 2022-01-07| 5000093X| -619294125.98 | LO1
2022-01-08 | 2022-01-07| 1079653X| -650000000.00 | LO2
2022-01-10 | null | 5000093X| -619294125.98 | LO1
2022-01-10 | null | 1079653X| -650000000.00 | LO2
2022-01-11 | 2022-01-10| 5000093X| -619294125.98 | LO1
2022-01-11 | 2022-01-10| 1079653X| -650000000.00 | LO2
2022-01-12 | 2022-01-11| 5000093X| -596544416.08 | LO1
2022-01-12 | 2022-01-11| 1079653X| -650000000.00 | LO2
How can I get and join the data from Saturday or day before public holiday?
This is my dbfiddle: https://dbfiddle.uk/9NLAopij