select a.* from 表1 a where a.字段A<>表2.字段A ordar by a.字段A
select * from 表1 where not exists (select 1 from 表2 where 表2.字段A =表1.字段A )
select t.* from 表1 t where not exists(select 1 from 表2 字段A=t.字段A)
create table #t (col varchar(1)) insert into #t select 'a' union select 'c' union select 'f'create table #t2 (col varchar(1)) insert into #t2 select 'a' union select 'b' union select 'c' union select 'd' union select 'e' union select 'f'select a.* from #t2 a left join #t b on a.col=b.col where b.col is null col ---- b d e
select a.字段A from 表1,表2 where a.字段A<>表2.字段A
最简单的 select a.A from a where A not in(select A from b)或者select a.A from a,b where a.A *=b.A and b.A is not null
where not exists
(select 1 from 表2 where 表2.字段A =表1.字段A )
insert into #t
select 'a'
union
select 'c'
union
select 'f'create table #t2 (col varchar(1))
insert into #t2
select 'a'
union
select 'b'
union
select 'c'
union
select 'd'
union
select 'e'
union
select 'f'select a.* from #t2 a left join #t b on a.col=b.col where b.col is null
col
----
b
d
e
select a.A from a
where A not in(select A from b)或者select a.A
from a,b
where a.A *=b.A
and b.A is not null
tangqijun199(撒旦.搏一搏,3角变4角.冲刺5角中……
回答的好认真,赞一下