当前位置: 代码迷 >> Sql Server >> 效率删除解决方案
  详细解决方案

效率删除解决方案

热度:83   发布时间:2016-04-27 13:37:35.0
效率删除
弱弱地问一下,两个表A,B。
A.ID B.ID
1 2
2 3
3 5
4
5
如何高效删除A表ID和B表ID不相等的记录,这里是1,4

------解决方案--------------------
delete A where not exists(select 1 from A,B where A.id = B.id)
------解决方案--------------------
SQL code
delete A where not exists(select 1 from A,B where A.id = B.id)
  相关解决方案