[development] SQL question.
greg.knaddison at gmail.com
Fri Feb 3 14:53:27 UTC 2006
On 2/2/06, Gordon Heydon <gordon at heydon.com.au> wrote:
> SELECT a.a, a.b, b.a, b.c FROM a LEFT JOIN b ON a.a = b.a WHERE b.c =
Another way to write this is:
SELECT a.a, a.b, b.a, b.c
FROM a LEFT JOIN b ON a.a = b.a
and 'A' = b.c;
Basically you put the condition into the left outer join so that when
the values are present, it qualifies them on "='A'" but if there are
none it will just show an empty row as you expect from the left outer
I'm not sure if that syntax works in postgresql or mysql as I didn't
test it, but I have some certainty about other sql engines.
More information about the development