Re: update from another table

Поиск
Список
Период
Сортировка
От Josh Berkus
Тема Re: update from another table
Дата
Msg-id web-70963@davinci.ethosmedia.com
обсуждение исходный текст
Ответ на update from another table  ("ivan" <IVANCCC@terra.es>)
Список pgsql-sql
Ivan,

> i would like to know how can i update a table with columns from
> another
> table and adding a new column with a secuence,

You cannot update a table and add a new column at with one statement.
Updating a table is Data Manipulation Language (DML) and adding a column
is Data Definition Language (DDL) and the two may not be combined.

For the update statement:

> update table
> set column = (select column from table2), ......, set
> column=secuence..
> 
> is it right?????

Nope.  Try

UPDATE table1 SET columnC = table2.columnB
FROM table2
WHERE table2.columnA = table1.columnA

-Josh Berkus


______AGLIO DATABASE SOLUTIONS___________________________                                      Josh Berkus Complete
informationtechnology      josh@agliodbs.com  and data management solutions       (415) 565-7293 for law firms, small
businesses       fax 621-2533   and non-profit organizations.      San Francisco
 


В списке pgsql-sql по дате отправления:

Предыдущее
От: Roberto Mello
Дата:
Сообщение: Re: PL/PGSQL
Следующее
От: Philip Hallstrom
Дата:
Сообщение: Re: Bit Mapping operation