b sql statement how to determine whether the column A of the table in a column data present in Table 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)

 

 

Guess you like

Origin www.cnblogs.com/lydg/p/11362343.html