3 Feb
2006
3 Feb
'06
5:41 a.m.
Basically I have 2 tables and I was to do a left join and pull out all rows which has a value in the right hand table or doesn't exist.
eg.
SELECT a.a, a.b, b.a, b.c FROM a LEFT JOIN b ON a.a = b.a WHERE b.c = 'A';
So basically I want it to return.
a b a c 1 1 null null 2 2 2 A
The problem here is that if b.c = 'A', it can't be NULL ;) So you should use something like this WHERE NVL(b.c, 'A') = 'A' (oracle Syntax, for MySQL it's IFNULL )