I have a table with "CODE", "DATA" columns and a table with "OLD CODE","NEW-CODE" columns used to map old code to new one. I need to perform a Join in order to get data with new codes, but only where available, otherwise I need to keep the old code. Is there a way to do something like "LEFT JOIN OR SELF" in order to set the value on the left side of the join for cases where the matching fails?
CODE DATA
- -
A 30
B 34
C 5
D 10
And this is the second Table
OLD CODE NEW CODE
B Ba1
C Ca2
D Da3
Now the expected result would be DATA from the first table with new code if available otherwise the old one.
CODE DATA
A 30
Ba1 34
Ca2 5
Da3 10