SQL - 从另一个 table 复制和替换数据

SQL - Copy and replace data from another table

我在将数据从具有相同结构的 table 复制到具有相同第一列的另一个 table 时遇到问题。我有 2 tables。一个是STANDARD,一个叫W2.

然后我选择一个名称,例如 Test。

我想将 STANDARD table 中除名称之外的值复制到 W2 table 中。所以替换这些值。正如您所看到的,Test 的值在 W2 table 中是不同的。我想用标准中的值替换这些值。

标准:

W3:

有人可以帮帮我吗?

试试这个

Update w2 set
    Maandag = (SELECT Maandag From STANDARD a where w2.id = a.id),
    Dinsdag = (SELECT Dinsdag From STANDARD a where w2.id = a.id)
    Etc....
Where w2.id = 'test'