table1 {
   name;
   age
}table2 {
   name;
   age
}想更新table1中的age等于table2中的age  但是要求name要对应update table1 a set age =  (select age from table2 where name = a.name)这样仿佛不对吧求sql

解决方案 »

  1.   

    doneupdate table1 a set (a.age) = (select age from table2 b where a.name = b.name)but how about 40 score of this question?
      

  2.   

    这样是用问题的,如果tab2中不存在的,tab1就被更新为空了update table1 a set a.age = (select age from table2 b where a.name = b.name)
    where exisits (select 1 from table2 c where a.name = c.name)
      

  3.   

    现已转为用merge实现因为无法结贴 特追加一个问题oracle10g如何提高merge的效率?