在SQL中如何删除b表中与a表不同的记录

树叶云

在SQL中如何删除b表中与a表不同的记录

 

  1. 删除b表中与a表不同的记录
  2. delete from b where not exists(select * from a where a.id=b.id and a.name=b.name)
  3. delete from b where b.id not in (select a.id from a) or b.name not in (select a.name from a)

delete from v9_photo_data where not exists(select * from v9_photo where v9_photo.id=v9_photo_data.id)
delete from v9_material_data where not exists(select * from v9_material where v9_material.id=v9_material_data.id)

 

文章来源网络,作者:运维,如若转载,请注明出处:https://shuyeidc.com/wp/114913.html<

(0)
运维的头像运维
上一篇2025-02-17 23:28
下一篇 2025-02-17 23:29

相关推荐

发表回复

您的邮箱地址不会被公开。必填项已用 * 标注