0

我在这样的存储过程中有一个查询:

"DELETE FROM tbl1 
 WHERE id1
  NOT IN (SELECT id FROM tbl2)
  AND id2 
    NOT IN(SELECT id FROM tbl2);" 

现在我想知道如何只使用一次内部 SELECT ?它能有效提高执行速度吗?

4

1 回答 1

1
delete from tbl1 
where not exists (select 1 from tbl2 where id in (tbl1.id1,tbl1.id2))
于 2012-11-11T06:24:38.663 回答