update b set b.b3=a.a3,b.b4=a.a4,b.b5=a.a5,b.b6=a.a6
from table1 as a
  inner join table2 b on a.id=b.id

解决方案 »

  1.   

    update table1
    set a3=B.b3,
        a4=B.b4,
        a5=B.b5,
        a6=B.b6
    from table1 A
    join table2 B on A.id=B.id或者update table1
    set a3=(select b3 from table2 where id=t.id),
        a4=(select b4 from table2 where id=t.id),
        a5=(select b5 from table2 where id=t.id),
        a6=(select b6 from table2 where id=t.id)
    from table1 t
      

  2.   

    update table2 set b3=a.a3,b4=a.a4,b5=a.a5,b6=a.a6 from table1 a join table2 b  on a.id=b.id