Re: UPDATE table SET col = (SELECT ...)

Поиск
Список
Период
Сортировка
От Ian Barwick
Тема Re: UPDATE table SET col = (SELECT ...)
Дата
Msg-id 200306262311.10435.barwick@gmx.net
обсуждение исходный текст
Ответ на UPDATE table SET col = (SELECT ...)  ("Vangelis-Maria Tougia" <tougias@cytanet.com.cy>)
Список pgsql-sql
On Wednesday 25 June 2003 11:00, Vangelis-Maria Tougia wrote:
> Hi,
> I found follwing email sent to you in internet.
> I am interested in same issue myself.
> Did you finally found out any more information about how to Update a column
> of a table by selecting value from another table?

Not sure if this has been answered previously, but here goes:

> Hello,
>
> If I understand the SQL references I have read, UPDATEs are allowed to
> pull data from SELECT statements, something like
>
>   UPDATE table SET col1 = (SELECT val1 FROM table WHERE id = 34),
>                SET col2 = (SELECT val2 FROM table WHERE id = 34)                ^^^
>          WHERE id = 35;

The second "SET" is not necessary or allowed and is causing the update to
fail.


Ian Barwick
barwick@gmx.net




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

Предыдущее
От: "murali"
Дата:
Сообщение: Postgres - Delphi Application
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Rules: passing new/old to functions