原文链接:http://www.cnblogs.com/onesmail/p/6148979.html

方法一:

 select distinct A.ID from  A where A.ID not in (select ID from B)

方法二:

select A.ID from A left join B on A.ID=B.ID where B.ID is null

方法三:

select * from  B  where (select count(1) as num from A where A.ID = B.ID) = 0

方法四:

SELECT * FROM b WHERE NOT EXISTS(SELECT 1 FROM a WHERE tel_no=b.tel_no)

 

方法五:

--相同数据
select tel_no  
from a
intersect
select tel_no 
from b

--不同数据
select tel_no  
from b
except
select tel_no 
from a

相关文章:

  • 2021-10-16
  • 2021-12-21
  • 2021-07-16
  • 2021-10-04
  • 2021-11-28
  • 2021-09-23
  • 2021-12-30
  • 2022-12-23
猜你喜欢
  • 2021-12-08
  • 2022-12-23
  • 2021-07-11
  • 2021-11-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案