SQL update fields of one table from fields of another one

前端 未结 7 599
傲寒
傲寒 2020-12-04 08:51

I have two tables:

A [ID, column1, column2, column3]
B [ID, column1, column2, column3, column4]

A will always be subset of

7条回答
  •  既然无缘
    2020-12-04 09:32

    You can use the non-standard FROM clause.

    UPDATE b
    SET column1 = a.column1,
      column2 = a.column2,
      column3 = a.column3
    FROM a
    WHERE a.id = b.id
    AND b.id = 1
    

提交回复
热议问题