比如:select * from table where name = 'a' and age ='b' and address ='c'
union
select * from table where name = 'q' and age ='w' and address ='e'
union
select * from table where name = 'j' and age ='k' and address ='l'
--------------------编程问答--------------------
你用某些行的条件先过滤出来,然后再从所有数据中去除掉。
没有id的话,可以用过滤某些行的条件去对比
--------------------编程问答--------------------
SELECT * FROM table WHERE not EXISTS
(SELECT * FROM
(select * from table where name = 'a' and age ='b' and address ='c'
union
select * from table where name = 'q' and age ='w' and address ='e'
union
select * from table where name = 'j' and age ='k' and address ='l' ) t
WHERE table.name=t.name and table.age=t.age and table.address=t.address)
--------------------编程问答--------------------
有一个表table,查询不包含某些行的数据,某些行即是在这个表中筛选的数据:select * from table where ....
select * from 表 where not exists (select 1 from 表 where '唯一主见'='不想显示')
--------------------编程问答--------------------
begin
select *,Identity(int,1,1) as Id into #temp from table
select * from #temp a,(
select * from #temp where name = 'a' and age ='b' and address ='c'
union
select * from #temp where name = 'q' and age ='w' and address ='e'
union
select * from #temp where name = 'j' and age ='k' and address ='l') b
where a.Id<>b.Id
end
--------------------编程问答--------------------
--------------------编程问答--------------------
这个问题居然还有这么多人回答! 怎么答啊 没头没尾的!
--------------------编程问答--------------------
看了下,既然知道所有行,那不想要一些行,用not exists不可以满足要求了么?