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

http://dev.mysql.com/doc/mysql/en/Comparison_Operators.html

Shawn Green
Database Administrator
Unimin Corporation - Spruce Pine

Keith Ivey <keith@stripped> wrote on 10/25/2004 03:11:53 PM:

> 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 other database, it's a bug in that 
database.
> 
> See these pages about MS SQL Server and PostgreSQL (which does have a 
> workaround), for
> example:
> 
> http://msdn.microsoft.com/library/default.asp?url=/library/en-
> us/acdata/ac_8_qd_02_8pwy.asp
> 
http://www.sql.org/sql-database/postgresql/manual/functions-comparison.html
> 
> -- 
> Keith Ivey <keith@stripped>
> Washington, DC
> 
> 
> -- 
> MySQL General Mailing List
> For list archives: http://lists.mysql.com/mysql
> To unsubscribe:    http://lists.mysql.com/mysql?unsub=1
> 

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