Try this: see the DEMO
select * from TableName where 1 NOT IN(x,y)
Question
I have a table in DB like that
i want to select all except the record contain (x=1, y=1) i mean the id=8
id | x | y
---------------
1 | 2 | 1
2 | 0 | 1
3 | 5 | 6
4 | 6 | 4
5 | 7 | 4
6 | 7 | 4
7 | 5 | 7
8 | 1 | 1
Solution
Try this: see the DEMO
select * from TableName where 1 NOT IN(x,y)
OTHER TIPS
Try this query
SELECT * FROM TableName where x!=1 OR y!=1
Following doctrine should work for you.
Doctrine_Query::Create() ->from("tablename") ->where("x != 1 AND Y != 1") ->fetchArray();
you can try this-
select * from TableName where x!=1 and y!=1
try this
SELECT * FROM test where 1 NOT IN(x) OR 1 NOT IN (y)
see demo... http://www.sqlfiddle.com/#!2/dd008/12