什么语句可以根据ID号更新table1中的2个字段C1和C2。更新的内容来自TABLE2中的F2和f1字段。

解决方案 »

  1.   

    UPDATE A
    SET A.C1=B.F2,A.C2=B.F1
    FROM TABLE1 A,TABLE2 B
    WHERE A.ID=B.ID
      

  2.   

    update table1
    set c1=f1 ,c2=f2
    from tabl2 
    where tabl1.id=table2.id
      

  3.   

    update a set a.c1=b.f2,a.c2=b.f1 from table1 a join table 2 b on a.id=b.id
      

  4.   

    update a set a.c1=b.f2,a.c2=b.f1 from table1 a join table2 b on a.id=b.id
      

  5.   

    update table1 set 
        table1.c1=table2.f2,table1.c2=table2.f1
    from table2
    where table1.id=table2.id