select 'x' from ip_user_count_05 b where a.id_no=b.id_no and a.area_code=b.area_code
这一句是什么意思??就是为了看是否有满足符合条件的记录吗?
给你分析一下你的语句:
首先查询条件,select 'x' from ip_user_count_05 b where a.id_no=b.id_no and a.area_code=b.area_code 肯定是存在的,
所以对每一条纪录,都会delete from ip_temp ,因为条件始终成立!!也就是说你把整个ip_temp 
都删除了,结果自己去想。。

解决方案 »

  1.   

    sorry,上面的好像错了,嘿嘿。。不好意思
      

  2.   

    delete from ip_temp a
    where exists(select 1 from ip_user_count_05 b where ( b.id_no, b.area_code ) in ( a.id_no, a.area_code ) )ordelete from ip_temp a
    where ( a.id_no, a.area_code ) in (select b.id_no, b.area_code from ip_user_count_05 b )
    -----------------------------------
    做一下执行分析看看
      

  3.   

    a.id_no,b.id_no ,a.area_code,b.area_code都创建索引了吗?
      

  4.   

    delete from ip_temp a
    where exists(select 'x' from ip_user_count_05 b where a.id_no=b.id_no and a.area_code=b.area_code)
    是没有响应还是速度慢?