select * from A where aaa not in (select bbb from B)就可以了啊
下面是运行的例子:
declare @A table(aaa char(2))
insert into @A
select 'aa' union all
select 'bb' union all
select 'cc' union all
select 'dd' union all
select 'ee' union all
select 'ff' union all
select 'gg' union all
select 'hh'
declare @B table(bbb char(2))
insert into @B
select 'dd' union all
select 'ee' union all
select 'ff' union all
select 'gg'
select aaa from @A where aaa not in (select bbb from @B)