List:General Discussion« Previous MessageNext Message »
From:Jasper Bryant-Greene Date:September 19 2005 4:02am
Subject:Re: Yet another null question
View as plain text  
doug@stripped wrote:
> Thanks but I still do not get why this does not merit a, "you might want to
> think about this".
> 
> So in the following query:
> 
>  select * from new_payments where closed<>1;
> 
> it is desired that null=1. DeMorgan's law takes a vacation here.
> 
> Correct behavior, in that it is a feature, I expected that; desired - no
> comment. Probably not expected in that selecting for closed=1 and closed<>1
> does
> not yield symmetric results. It was the [not] expected nature that lead me to
> suggest perhaps an example might be helpful.

Please don't top-post. If you want symmetric results from closed=1 and 
closed<>1 then you should declare the column as NOT NULL (or not make 
use of NULL values, but the former is preferable).

Either that, or reformulate your query to specify what you really mean:

SELECT * FROM new_payments WHERE closed<>1 OR closed IS NULL;

-- 
Jasper Bryant-Greene
Freelance web developer
http://jasper.bryant-greene.name/
Thread
Yet another null questiondoug19 Sep
  • Re: Yet another null questionRoger Baklund19 Sep
    • Re: Yet another null questiondoug19 Sep
      • Re: Yet another null questionJasper Bryant-Greene19 Sep
      • Re: Yet another null questionJoerg Bruehe20 Sep
        • Re: Yet another null questiondoug20 Sep
    • Re: Yet another null questiondoug19 Sep
  • Re: Yet another null questionMartijn Tonies19 Sep
    • Re: Yet another null questiondoug19 Sep