Re: bug or feature, <> 'blah' does NOT work with null records

2004-10-30 Thread Martijn Tonies
> > Fortunately there is function COALESCE() that will return the first argument > > that is not NULL. In case of NULL values you can use a default value for an > > expression: COALESCE( `col`*2, 14) will produce 14 if `col` is NULL. > > FWIW, IFNULL() does the same thing, with a clearer (to me) n

Re: bug or feature, <> 'blah' does NOT work with null records

2004-10-29 Thread Pete Harlan
On Thu, Oct 28, 2004 at 11:50:12AM +0200, Jigal van Hemert wrote: ... > Fortunately there is function COALESCE() that will return the first argument > that is not NULL. In case of NULL values you can use a default value for an > expression: COALESCE( `col`*2, 14) will produce 14 if `col` is NULL.

Re: bug or feature, <> 'blah' does NOT work with null records

2004-10-28 Thread Jigal van Hemert
From: "Harald Fuchs" <[EMAIL PROTECTED]> > In article <[EMAIL PROTECTED]>, > "Jigal van Hemert" <[EMAIL PROTECTED]> writes: > > > Fortunately there is function COALESCE() that will return the first argument > > that is not NULL. In case of NULL values you can use a default value for an > > expres

Re: bug or feature, <> 'blah' does NOT work with null records

2004-10-28 Thread Harald Fuchs
In article <[EMAIL PROTECTED]>, "Jigal van Hemert" <[EMAIL PROTECTED]> writes: > NULL is meant to indicate that the value is unknown. If a value is unknown > it can be anything. > So, in the example `col` <> 'blah', col can be anything, including 'blah'. > If you take that into consideration the o

Re: bug or feature, <> 'blah' does NOT work with null records

2004-10-28 Thread Jigal van Hemert
From: "Harald Fuchs" <[EMAIL PROTECTED]> > Yes, of course. "NULL <> 'blah'" returns NULL, and that's perfectly > standards-conformant. Furthermore, it's quite logical. NULL is meant to indicate that the value is unknown. If a value is unknown it can be anything. So, in the example `col` <> 'bla

Re: bug or feature, <> 'blah' does NOT work with null records

2004-10-28 Thread Harald Fuchs
In article <[EMAIL PROTECTED]>, matt_lists <[EMAIL PROTECTED]> writes: > I cant tell if this is a bug or a feature. > Select from table where col <> 'blah' > I use this all the time with other databases, works great, gives me > everything that's not "blah" If those "other databases" return also

Re: bug or feature, <> 'blah' does NOT work with null records

2004-10-25 Thread SGreen
MySQL also has a work around. You might try to rephrase your comparison as WHERE not col <=> 'blah' the "<=>" operator is documented as a null-enabled equality check. That way if you are comparing null to null, you get a true or false and not another null. This comparator is available as of 3

Re: bug or feature, <> 'blah' does NOT work with null records

2004-10-25 Thread Paul DuBois
At 14:51 -0400 10/25/04, matt_lists wrote: I cant tell if this is a bug or a feature. Select from table where col <> 'blah' I use this all the time with other databases, works great, gives me everything that's not "blah" but in mysql, it wont work if there's null records in the table That is the

Re: bug or feature, <> 'blah' does NOT work with null records

2004-10-25 Thread Keith Ivey
matt_lists wrote: I cant tell if this is a bug or a feature. Select from table where col <> 'blah' I use this all the time with other databases, works great, gives me everything that's not "blah" In SQL (not just MySQL), any comparisons involving NULL return NULL, so if that was working in some o

RE: bug or feature, <> 'blah' does NOT work with null records

2004-10-25 Thread Jay Blanchard
[snip] I cant tell if this is a bug or a feature. Select from table where col <> 'blah' I use this all the time with other databases, works great, gives me everything that's not "blah" but in mysql, it wont work if there's null records in the table I have to do this, select from table where (