UPDATE the field of a table with fields from another table - Mailing list pgsql-novice

From Balvie
Subject UPDATE the field of a table with fields from another table
Date
Msg-id 45329891.4070106@ibb.nl
Whole thread Raw
Responses Re: UPDATE the field of a table with fields from another table  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-novice
Hi,

I use: Postgres 7.3.10 and Pgadmin 1.4.3 on RH Linux

I got 2 tables with names and telephone numbers:

CREATE TABLE b1_naam
(
   relcode varchar(10),
   naam varchar(100),
   telnr varchar(30)
)

CREATE TABLE b1_telco
(
   relcode varchar(10),
   telnr varchar(30),
   ppc varchar(25)
)

and I need to restore some data. I created something like:

UPDATE b1_naam
   SET telnr = t.telnr
   FROM b1_telco as t
   WHERE
     b1_naam.relcode = b1_telco.relcode AND
     b1_naam.naam like 'Bakke%';

Can anyone tell me what I did wrong? I have seen very complicated
statements with nested selects. I cannot believe that a simple query,
like the one I wrote above, is not available.

Thanks,

Balvie

pgsql-novice by date:

Previous
From: Sean Davis
Date:
Subject: Re: -- New to read from Oracle and insert into Postgress
Next
From: Tom Lane
Date:
Subject: Re: UPDATE the field of a table with fields from another table