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

时间:2015-11-09 来源:风信官网 点击: 724次

  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)

X孝感风信网络科技有限公司

截屏,微信识别二维码

微信号:189 8648 0214

(点击微信号复制,添加好友)

  打开微信

微信号已复制,请打开微信添加咨询详情!