UPDATE 表关联优化

优化前:

update table1 a set co1 =(select co2 from table2 b where   b.co3=a.co3  )

where  exists =(select 1 from table2 b where   b.co3=a.co3  )

优化后:

update  (select a.co1,b.co2  from sa.table1 a , sa.table2 b where b.co3=a.co3   )      set  co1=  co2

 b.co3=a.co3必须为唯一

posted @ 2013-12-05 15:45  bj_google  阅读(291)  评论(0编辑  收藏  举报