[development] SQL question.

Gordon Heydon gordon at heydon.com.au
Fri Feb 3 05:20:59 UTC 2006


Hi,

Thanks I got put onto the IS NULL and this works a treat.

Gordon.

On Thu, 2006-02-02 at 22:41 -0600, Nicolas Tostin wrote:
> > 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 )
> 
> !DSPAM:1000,43e2e744149975757113115!
> 



More information about the development mailing list