查看一个表中的数据是否在另一个表中存在
第一种方案:
select * from tb_a A where NOT EXISTS (select 1 from tb_b B where A.ID = B.ID)
第二种方案:
select * from tb_a A where A.ID NOT IN(select B.ID from tb_b B )
查看一个表中的数据是否在另一个表中存在
第一种方案:
select * from tb_a A where NOT EXISTS (select 1 from tb_b B where A.ID = B.ID)
第二种方案:
select * from tb_a A where A.ID NOT IN(select B.ID from tb_b B )
本文标题:查看一个表中的数据是否在另一个表中存在
本文链接:https://www.haomeiwen.com/subject/sebrmqtx.html
网友评论