欢迎您光临自学哈网,只为分享网络知识教程,供大家学习参考!

「自学哈网」在SQL中如何删除b表中与a表不同的记录

作者 : 自学哈 本文共402个字,预计阅读时间需要2分钟 2023-08-4 共69人阅读
也想出现在这里? 联系我们

在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)

 

本站声明:
本站所有资源来源于网络,分享目的仅供大家学习和交流!如若本站内容侵犯了原著者的合法权益,可联系邮箱976157886@qq.com进行删除。
自学哈专注于免费提供最新的分享知识、网络教程、网络技术的资源分享平台,好资源不私藏,大家一起分享!

自学哈网 » 「自学哈网」在SQL中如何删除b表中与a表不同的记录
也想出现在这里? 联系我们
© 2022 Theme by - 自学哈网 & WordPress Theme. All rights reserved 浙ICP备2022016594号