有两张表记录都约为200万条,进行更新操作,语句如下:
update infotemp set occurdate = '2011/04/07',bal = (select bal from tempnew a where infotemp.acno=a.acno) where exists  (select 1 from tempnew c where infotemp.acno = c.acno)表索引是以acno为唯一字段感觉执行了好长时间,有没有用其他方法更快一点?

解决方案 »

  1.   


    update infotemp 
    set occurdate = to_date('2011/04/07',yyyy/mm/dd)
        bal = (select bal from tempnew a where infotemp.acno=a.acno)
    where exists  
          (select 1 from tempnew c where infotemp.acno = c.acno);不知道,顶一下,等GS
      

  2.   


    update infotemp 
    set occurdate = '2011/04/07',
    bal =tempnew.bal
    join tempnew 
    on infotemp.acno = tempnew.acno
      

  3.   


    update infotemp 
    set occurdate = '2011/04/07',
    bal =tempnew.bal
    from infotemp
    join tempnew 
    on infotemp.acno = tempnew.acno