List:General Discussion« Previous MessageNext Message »
From:Harald Fuchs Date:October 28 2004 11:25am
Subject:Re: bug or feature, <> 'blah' does NOT work with null records
View as plain text  
In article <001f01c4bcd3$84cf5c80$2801a8c0@localdomain>,
"Jigal van Hemert" <jigal@stripped> 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 only outcome of `col` <> 'blah' if
> `col` = NULL *must* be NULL!

> 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.

This idiom, albeit terse, is not something you should get used to,
because it precludes index usage.

Thread
bug or feature, <> 'blah' does NOT work with null recordsmatt_lists25 Oct
  • Re: bug or feature, <> 'blah' does NOT work with null recordsKeith Ivey25 Oct
    • Re: bug or feature, <> 'blah' does NOT work with null recordsSGreen25 Oct
  • Re: bug or feature, <> 'blah' does NOT work with null recordsPaul DuBois25 Oct
  • Re: bug or feature, <> 'blah' does NOT work with null recordsHarald Fuchs28 Oct
  • Re: bug or feature, <> 'blah' does NOT work with null recordsJigal van Hemert28 Oct
    • Re: bug or feature, <> 'blah' does NOT work with null records(Pete Harlan)29 Oct
  • Re: bug or feature, <> 'blah' does NOT work with null recordsHarald Fuchs28 Oct
  • Re: bug or feature, <> 'blah' does NOT work with null recordsJigal van Hemert28 Oct
  • Re: bug or feature, <> 'blah' does NOT work with null recordsMartijn Tonies30 Oct
RE: bug or feature, <> 'blah' does NOT work with null recordsJay Blanchard25 Oct