I think that's confusing, but right. every null value is distinct, thus null != null.
weird, but null is not a value, it's the lack of a value, so nothing can be shown about it. so, SELECT IF( NULL = NULL, 0 , 1 ) AS RESULT ; is not the same as SELECT IF( NULL is NULL, 0 , 1 ) AS RESULT ; -----Original Message----- From: Harald Fuchs [mailto:lists-mysql@;news.protecting.net] Sent: Friday, October 25, 2002 5:42 AM To: [EMAIL PROTECTED] Subject: Re: Strange behavior of CASE .. WHEN ... THEN.... In article <000701c27193$1bf2bfa0$aa3fe7cb@jsheo>, "Heo, Jungsu" <[EMAIL PROTECTED]> writes: > Hello, every one. > I Found a bug about CASE .. WHEN .. THEN.. mysql> SELECT VERSION() ; > +------------+ > | VERSION() | > +------------+ > | 4.0.3-beta | > +------------+ > 1 row in set (0.00 sec) mysql> select CASE NULL WHEN NULL THEN 0 ELSE 1 END AS RESULT ; > +--------+ > | RESULT | > +--------+ > | 1 | > +--------+ > 1 row in set (0.00 sec) > I think RESULT should be '0'. Am I wrong? > IF() works finely. mysql> SELECT IF( NULL IS NULL, 0 , 1 ) AS RESULT ; > +--------+ > | RESULT | > +--------+ > | 0 | > +--------+ > 1 row in set (0.00 sec) > Is this a bug or a mistake of mine? The latter one. While "NULL IS NULL" returns true, "NULL = anything" returns false, even if "anything" is NULL. [Filter fodder: SQL query] --------------------------------------------------------------------- Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php