sql语句 如何判断A表中的a列数据是否在B表中的b列中存在

--存在
select *
from A
where exists(select 1 from B where A.a = B.b)
--不存在
select *
from A
where not exists(select 1 from B where A.a = B.b)

 

 

posted @ 2019-08-16 10:30  临沂东哥  阅读(2455)  评论(0编辑  收藏  举报