比如: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'
select* from TABLE where userid not in(select * from TABLE)
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)
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
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'
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)
select * from 表 where not exists (select 1 from 表 where '唯一主见'='不想显示')
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