0

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
user1272589
  • 789
  • 1
  • 10
  • 25

5 Answers5

2

Try this: see the DEMO

select * from TableName where 1 NOT IN(x,y)
sandip
  • 3,279
  • 5
  • 31
  • 54
1

Try this query

SELECT * FROM TableName where x!=1 OR y!=1
Sumit Bijvani
  • 8,154
  • 17
  • 50
  • 82
1

Following doctrine should work for you.

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

Jaskaran Singh
  • 2,392
  • 24
  • 39
0

you can try this-

select * from TableName where x!=1 and y!=1
Suresh Kamrushi
  • 15,627
  • 13
  • 75
  • 90
0

try this

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

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

thumber nirmal
  • 1,639
  • 3
  • 16
  • 27