I have a query where I want all values from TABLE.1 to be selected when the where clause is true. However, in this table there are some null values in the key field to TABLE.2 that I am joining to get a description. I am not able to pull the record's that have the null key field to the other table, but I want them and just want the description from the other table to be null.
Basically what I have is:
select
a.x,
a.y,
a.z,
d.desc
FROM TABLE.1 a
LEFT JOIN TABLE.2 d ON a.key = d.id
WHERE a.code = 'XYZ'
But some a.key are null, and I still want to display a.x, a.y, a.z for all records even when a.key is null. But everything I try will not work. I am hoping someone can show me the correct way to build this query. Thank you.
Basically what I have is:
select
a.x,
a.y,
a.z,
d.desc
FROM TABLE.1 a
LEFT JOIN TABLE.2 d ON a.key = d.id
WHERE a.code = 'XYZ'
But some a.key are null, and I still want to display a.x, a.y, a.z for all records even when a.key is null. But everything I try will not work. I am hoping someone can show me the correct way to build this query. Thank you.