From: Andre Schubert <andre.schubert@km3.de>
To: Manfred Koizar <mkoi-pg@aon.at>
Cc: pgsql-sql@postgresql.org
Subject: Re: How to update
Date: Mon, 3 Jun 2002 15:46:46 +0200
Message-ID: <20020603154646.4ce61690.andre.schubert@km3.de> (raw)
In-Reply-To: <pfomfug81ska9234r96d3m58gppqimmift@4ax.com>
References: <20020603100028.38dd8a7e.andre.schubert@km3.de>
<pfomfug81ska9234r96d3m58gppqimmift@4ax.com>
On Mon, 03 Jun 2002 15:08:46 +0200
"Manfred Koizar" <mkoi-pg@aon.at> wrote:
> 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) b
> WHERE foo.ip = b.ip;
>
> Servus
> Manfred
Thank you very much, this always works for me... :)
Regards
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: andre.schubert@km3.de, mkoi-pg@aon.at
Subject: Re: How to update
In-Reply-To: <20020603154646.4ce61690.andre.schubert@km3.de>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox