How to update between two tables?

Hello there!

I have an original table where I want to update a column with values from another table.
How do I do that?

My original table is named Land and the table that contains the new values is Landsnummer, and the corresponding columns are both called Land.
I’ve tried to run an SQL-expression like this in Base but it doesn’t work:

UPDATE “Land”
SET “Land”.“Landsnummer” = “Landsnummer”.“Landsnummer”
WHERE “Land”.“Land” = “Landsnummer”.“Land”

I might also mention that I only work inside Base. Not connected to any external database or so.

I got a suggestion from another forum that solved the problem:

update “Land” set “Land”.“Landsnummer” =
(select “Landsnummer”.“Landsnummer” from “Landsnummer” where “Land”.“Land” = “Landsnummer”.“Land”)
where exists
(select “Landsnummer”.“Landsnummer” from “Landsnummer” where “Land”.“Land” = “Landsnummer”.“Land”)

Hope it can help someone else! :wink:

/Ramne