Ask Your Question
0

How to update between two tables? [closed]

asked 2013-02-12 13:49:38 +0100

this post is marked as community wiki

This post is a wiki. Anyone with karma >75 is welcome to improve it.

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.

edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by Alex Kemp
close date 2015-10-22 02:36:22.376990

1 Answer

Sort by » oldest newest most voted
0

answered 2013-02-18 01:07:10 +0100

this post is marked as community wiki

This post is a wiki. Anyone with karma >75 is welcome to improve it.

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! ;-)

/Ramne

edit flag offensive delete link more

Question Tools

Stats

Asked: 2013-02-12 13:49:38 +0100

Seen: 494 times

Last updated: Feb 18 '13