I'm not sure why you would use the syntax you are trying to use. I think you are making a few assumptions that may be incorrect. If you do this query:
SELECT not name='Bob' FROM person
You'll see your result is set contains all 0's. Records where name='Bob' would return 1, but you are taking the opposite of 1, which would be 0. For those records that return 0, you want the opposite of 0, which is????? Infinity? If you convert infinity to boolean, it would be false. So from my point of view, MySQL is using the correct precedence.


If you want to find all records that are not Bob, why not just us this syntax:
SELECT * FROM person WHERE name!='Bob'


It's more efficient since there is only one comparison occurring instead of two, negating name='Bob'. After all, you are looking to negate the equal, not negate name.

On Friday, October 3, 2003, at 07:42 AM, Ed Smith wrote:

In mySQL 4.1-alpha, 4.0.15a, and 3.23.58, I get the
following results:

mysql> SELECT * FROM person WHERE NOT name = 'Bob';
Empty set (0.00 sec)

mysql> SELECT * FROM person WHERE NOT (name = 'Bob')
+------+
| name |
+------+
| Jane |
+------+
1 row in set (0.00 sec)

--
Brent Baisley
Systems Architect
Landover Associates, Inc.
Search & Advisory Services for Advanced Technology Environments
p: 212.759.6400/800.759.0577


-- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]



Reply via email to