Page 1 of 1

Where clause and operators

Posted: Sat Nov 20, 2004 4:34 pm
by Perfidus
Does the != operator work for the WHERE clause in a mysql query?
I'm trying a query like "SELECT FROM $table WHERE Num!=1 AND Num!=2" but it doesn't seem to work...

Any hints?

Posted: Sat Nov 20, 2004 4:36 pm
by MarK (CZ)
!= works.
There should be "SELECT columns or * FROM tablename ..."

Posted: Sat Nov 20, 2004 4:57 pm
by Perfidus
MarK (CZ) wrote:!= works.
There should be "SELECT columns or * FROM tablename ..."
Yes, it exist!
I have a nice * there!

Posted: Sat Nov 20, 2004 5:29 pm
by timvw
btw, you might want to use <> instead of != because that is the standard ;)

Posted: Sun Nov 21, 2004 8:02 am
by peni
it could be useful to put field names into `these` apostrophes and their values into 'these'.

Code: Select all

SELECT * FROM `$table` WHERE `Num`<>'1' AND `Num`<>'2'