user1272589
user1272589

Reputation: 809

Doctrine where not

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

Upvotes: 0

Views: 413

Answers (5)

Jaskaran Singh
Jaskaran Singh

Reputation: 2578

Following doctrine should work for you.

Doctrine_Query::Create() ->from("tablename") ->where("x != 1 AND Y != 1") ->fetchArray();

Upvotes: 1

thumber nirmal
thumber nirmal

Reputation: 1617

try this

 SELECT * FROM test where 1 NOT IN(x) OR 1 NOT IN (y)

see demo... http://www.sqlfiddle.com/#!2/dd008/12

Upvotes: 0

sandip
sandip

Reputation: 3289

Try this: see the DEMO

select * from TableName where 1 NOT IN(x,y)

Upvotes: 2

Sumit Bijvani
Sumit Bijvani

Reputation: 8179

Try this query

SELECT * FROM TableName where x!=1 OR y!=1

Upvotes: 1

Suresh Kamrushi
Suresh Kamrushi

Reputation: 16086

you can try this-

select * from TableName where x!=1 and y!=1

Upvotes: 0

Related Questions