update customer1  x
set (name1,name2)=(select name1,name2 from customer2 y where x.id1=y.id1 and x.id2=y.id2) 

解决方案 »

  1.   

    update customer1 a
    set (a.name1,a.name2)=(select b.name1 ,b.name2 from customer2 b 
    where a.id1=b.id1 
    and a.id2=b.id2 )
      

  2.   

    update customer1 a
    set (name1,name2)=(select name1,name2 from customer2 b where a.id1=b.id1 
    and a.id2=b.id2)
      

  3.   

    我觉得where里面两表的顺序应该倒过来更好些update customer1 a
    set (name1,name2)=(select name1,name2 from customer2 b where id1=a.id1 
    and id2=a.id2)
      

  4.   

    update customer1 a
    set (name1,name2)=(select name1,name2 from customer2 b where a.id1=b.id1 
    and a.id2=b.id2) where exists(select 1 from customer2 b where a.id1=b.id1 
    and a.id2=b.id2)