查看一个表中的数据是否在另一个表中存在

第一种方案:
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 );
Logo

更多推荐