Let’s say I have two data sets A
and B
After left join I should get FALSE
value for Y
in table A
as it doesn’t have it in table B
Advertisement
Answer
Using your approach, if you intend to get a value of FALSE
if the value doesn’t exist you can check for NULL
in the name. The example below uses a CASE
to check for NULL
and assigns the original value otherwise
x
SELECT
A.Name,
CASE
WHEN B.Name is NULL THEN 'FALSE'
ELSE A.Value
END as Value
FROM
A
LEFT JOIN
B on A.Name = B.Name