当前位置: 代码迷 >> Sql Server >> 怎么将表1中字段A值等于表2中字段A的记录删除
  详细解决方案

怎么将表1中字段A值等于表2中字段A的记录删除

热度:90   发布时间:2016-04-27 16:49:19.0
如何将表1中字段A值等于表2中字段A的记录删除?
表1的字段A和表2的字段A的结构是一直的,如何将表1中字段A值等于表2中字段A的记录删除?

------解决方案--------------------

delete 表1
where A in (select distinct A from 表2)
------解决方案--------------------
delete tmpA
from 表1 as tmpA, 表2 as tmpB
where tmpA.A=tmpB.A

------解决方案--------------------
delete from 表1 where exists(select * from 表2 wher a=表1.a)
------解决方案--------------------
DELETE TABLE1 FROM TABLE1 INNER JOIN TABLE2 ON TABLE1.ID=TABLE2.ID
------解决方案--------------------
delete from 表1,表2 where 表1.A = 表2.A
  相关解决方案