List:General Discussion« Previous MessageNext Message »
From:mfatene Date:May 10 2005 8:39pm
Subject:Re: Comparing to null queries
View as plain text  
Hi,
'l' is neither equal to null nor different from null.
you can try select ('l'!=NULL) or select ('l'=NULL).

in 4.1.x you should write :
   select * from table where del != l' or del is null;

mysql> select * from tbl;
+------+
| del  |
+------+
| NULL |
| a    |
| b    |
| l    |
| m    |
| l    |
+------+
6 rows in set (0.02 sec)

mysql>
mysql>
mysql> select * from tbl where del !='l';
+------+
| del  |
+------+
| a    |
| b    |
| m    |
+------+
3 rows in set (0.00 sec)

mysql> select * from tbl where del != 'l' or del is null;
+------+
| del  |
+------+
| NULL |
| a    |
| b    |
| m    |
+------+
4 rows in set (0.00 sec)


Mathias

Selon Mike Rykowski <rykowski@stripped>:

> Hello,
>
> I have a query:
>
> select * from table where del != "1";
>
> Let's assume that I have a record where del is null (del is a single
> character field).
>
> In version 3.23.22-beta I get the record returned with the above query,
> in version 4.1.10a I get nothing returned.
>
> Did something change between these versions or is this a bug?  I
> couldn't find anything specific to this on the archives.
>
> TIA
> --
> Mike Rykowski
> NU-IT Telecommunications and Network Services
>
>
> --
> MySQL General Mailing List
> For list archives: http://lists.mysql.com/mysql
> To unsubscribe:    http://lists.mysql.com/mysql?unsub=1
>
>


Thread
Comparing to null queriesMike Rykowski10 May
  • Re: Comparing to null queriesmfatene10 May
  • Re: Comparing to null queriesMichael Stassen10 May
  • Re: Comparing to null queriesPeter Brawley10 May