I have two tables.
TABLE_A
| SURNAME | COL_X |
TABLE_B
| ID | COL_Y |
COL_X can be mapped towards the ID column in table B, and I need the values from COL_Y.
The below query works fine except when COL_X in TABLE_A has a NULL value. I would like to include those rows. How do I do that?
SELECT a.SURNAME, b.COL_Y
FROM TABLE_A a
INNER JOIN TABLE_B b
ON a.COL_X = b.ID
I have tried the following query but it returns duplicate rows and can therefore not be used.
SELECT a.SURNAME, b.COL_Y
FROM TABLE_A a
INNER JOIN TABLE_B b
ON a.COL_X = b.ID or a.COL_X IS NULL