日期:2014-05-18 浏览次数:20721 次
if object_id('[tb]') is not null drop table [tb]
go
create table [tb]([A] int,[B] int)
insert [tb]
select 1,1 union all
select 1,2 union all
select 1,3 union all
select 2,1 union all
select 2,2 union all
select 3,3 union all
select 3,4
go
select * from tb t
where not exists(select 1 from tb where a=t.a and b<=2)
/**
A B
----------- -----------
3 3
3 4
(2 行受影响)
**/
------解决方案--------------------