Re: How to update

Поиск
Список
Период
Сортировка
От Manfred Koizar
Тема Re: How to update
Дата
Msg-id pfomfug81ska9234r96d3m58gppqimmift@4ax.com
обсуждение исходный текст
Ответ на How to update  (Andre Schubert <andre.schubert@km3.de>)
Ответы Re: How to update  (Andre Schubert <andre.schubert@km3.de>)
Список pgsql-sql
On Mon, 3 Jun 2002 10:00:28 +0200, Andre Schubert
<andre.schubert@km3.de> wrote:
>I tried this, but it update always one row in foo.
>
>update foo set inet=sum(bar.inet),local=sum(bar.local) where foo.ip = bar.ip;

Andre,
this worked in my test:

UPDATE foo  SET inet=b.i, local=b.l FROM (SELECT ip, sum(inet) AS i, sum(local) AS l         FROM bar       GROUP BY
ip)bWHERE foo.ip = b.ip;
 

ServusManfred


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

Предыдущее
От: Andre Schubert
Дата:
Сообщение: How to update
Следующее
От: Andre Schubert
Дата:
Сообщение: Re: How to update