UPDATE the field of a table with fields from another table

Поиск
Список
Период
Сортировка
От Balvie
Тема UPDATE the field of a table with fields from another table
Дата
Msg-id 45329891.4070106@ibb.nl
обсуждение исходный текст
Ответы Re: UPDATE the field of a table with fields from another table  (Tom Lane <tgl@sss.pgh.pa.us>)
Список 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 по дате отправления:

Предыдущее
От: Sean Davis
Дата:
Сообщение: Re: -- New to read from Oracle and insert into Postgress
Следующее
От: Tom Lane
Дата:
Сообщение: Re: UPDATE the field of a table with fields from another table