List:General Discussion« Previous MessageNext Message »
From:Paul DuBois Date:October 25 2004 7:24pm
Subject:Re: bug or feature, <> 'blah' does NOT work with null records
View as plain text  
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 correct behavior.

>
>I have to do this, select from table where ( col <> 'blah or isnull(col) )

You could use the <=> equality operator, which like like = except that it
also is true for NULL values:

NOT (col <=> 'blah')

-- 
Paul DuBois, MySQL Documentation Team
Madison, Wisconsin, USA
MySQL AB, www.mysql.com
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