日期:2014-05-18 浏览次数:20717 次
--> 测试数据:[test] if object_id('[test]') is not null drop table [test] create table [test]([字段A] varchar(1),[字段B] varchar(4)) insert [test] select 'A','结束' union all select 'A','开始' union all select 'A','开始' union all select 'A','开始' union all select 'A','开始' union all select 'A','开始' union all select 'B','开始' union all select 'B','开始' union all select 'B','开始' union all select 'C','开始' union all select 'C','开始' union all select 'C','开始' union all select 'C','开始' select * from test a where not exists(select 1 from test b where a.字段A=b.字段A and b.字段B='结束') /* 字段A 字段B B 开始 B 开始 B 开始 C 开始 C 开始 C 开始 C 开始 */