已经解决了。呵呵,脑子一下子没转过来。
以下是答案:
Declare @Tmp1 Table
(
Field1 Char(5),
Field2 Char(5)
)
Insert Into @Tmp1
Select 'AAA','111' Union
Select 'AAA','222' Union
Select 'AAA','333' Union
Select 'BBB','111' Union
Select 'BBB','222' Union
Select 'CCC','111' Union
Select 'CCC','222' Union
Select 'DDD','111' Union
Select 'DDD','222' Union
Select 'DDD','333'
Select Distinct Field1 From @Tmp1 A Where Not Exists(Select * From @Tmp1 B Where Field2='333' And A.Field1=B.Field1)