Re: select & insert

Поиск
Список
Период
Сортировка
От Arcady Genkin
Тема Re: select & insert
Дата
Msg-id 8766kfkknb.fsf@tea.thpoon.com
обсуждение исходный текст
Ответ на select & insert  (Mauricio Alarcon <malarcon@webdepot.com.co>)
Список pgsql-novice
Mauricio Alarcon <malarcon@webdepot.com.co> writes:

> How I can make an update to a register from a select query?
> I have this
>
> update table1 set r1=(select r1+1 from table1);

Try this:

update table1 set r1=(select T1.r1+1 from table1 T1);

Note that if there is more than one row in the table1, then you might
want to limit the select clause by some condition.
--
Arcady Genkin
Don't read everything you believe.

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

Предыдущее
От: Wayne Johnson
Дата:
Сообщение: Java vs. PHP (was web interface for postgreSQL-P.S.)
Следующее
От: Steve Waldman
Дата:
Сообщение: Re: Java vs. PHP (was web interface for postgreSQL-P.S.)