Is there a MySQL statement which is the equivelent of " !== " in PHP. I want to select everything UNLESS it has a particular ID number.
Thanks,
Printable View
Is there a MySQL statement which is the equivelent of " !== " in PHP. I want to select everything UNLESS it has a particular ID number.
Thanks,
WHERE ID <> [the_excluded_id]
<> to SQL is
!= to PHP
S
!= works as well although I think <> is the ANSI SQL standard way of NOT EQUAL TO.
And if you really want the MySQL way to do !== I think it's IS NOT NULL. :)
that's only to test if something's not NULL. :) it only compares a value to NULL. if you want to compare 2 non-NULL values, use =, <>, !=, or the NULL-safe version of =, <=>. e.g.
Code:mysql> SELECT NULL=NULL;
+-----------+
| NULL=NULL |
+-----------+
| NULL |
+-----------+
mysql> SELECT NULL<=>NULL;
+-------------+
| NULL<=>NULL |
+-------------+
| 1 |
+-------------+