According to this SQL join cheat-sheet , the left outer join in one column is as follows:
SELECT *
FROM a
LEFT JOIN b
ON a.foo = b.foo
WHERE b.foo IS NULL
I am wondering what it would look like with a join in multiple columns, should it be in the sentence OReither ?ANDWHERE
SELECT *
FROM a
LEFT JOIN b
ON a.foo = b.foo
AND a.bar = b.bar
AND a.ter = b.ter
WHERE b.foo IS NULL
OR b.bar IS NULL
OR b.ter IS NULL
or
SELECT *
FROM a
LEFT JOIN b
ON a.foo = b.foo
AND a.bar = b.bar
AND a.ter = b.ter
WHERE b.foo IS NULL
AND b.bar IS NULL
AND b.ter IS NULL
?
(I don't think so, but if that matters, the db engine is Vertica)
(I bet on OR)
source
share