SQL query excluding something
Posted: Thu Jun 10, 2004 10:40 am
I discovered this by accident and have been unable to verify it in documentation, so perhaps somone here can do so. It seems to work, but...
I have an integer column which may contain values between 1 and 6 and I have been excluding records with a value of 2 with the following SQL statement:
That's fine when it's the only condition, but becomes a bit awkward when it's part of a much (much) longer statement. This seems to do the same thing, but is it valid as part of a larger statement and can I count on it?
Sorry, using MySQL.

I have an integer column which may contain values between 1 and 6 and I have been excluding records with a value of 2 with the following SQL statement:
Code: Select all
SELECT * FROM Table WHERE (Col<2 OR Col>2) AND...Code: Select all
SELECT * FROM Table WHERE Col-2 AND...