From: Patrick JACQUOT <patrick.jacquot@anpe.fr>
To: pgsql-sql@postgreSQL.org
Subject: Re: [SQL] found a way to update a table with data from another one
Date: Wed, 01 Dec 1999 10:32:55 +0100
Message-ID: <3844EB46.EDFA7129@anpe.fr> (raw)
References: <20827.943975363@sss.pgh.pa.us>
Tom Lane wrote:
> Patrick JACQUOT <patrick.jacquot@anpe.fr> writes:
> > I found a simpler way to do the job I wanted done
>
> > UPDATE t1 SET balance = balance+t2.amount WHERE EXISTS (SELECT *
> > FROM t2 WHERE t2.id = t1.id)
>
> > DOES WORK PROPERLY.
>
> Does it? I don't think that this will do what you are expecting,
<snip>
I thank you very much for your advice. I didn't try indeed to
put more than one line in T2.
I tried before to use your approach bu i used the wrong syntax :
UPDATE t1 SET Balance=Balance+(SELECT Amount FROM t2 WHERE t2.id=t1.id);
which gave me 'parser : parser error near select'.
I am really sorry havig done such a mistake, and apologize
Next time i'll turn my tongue seven times in my mouth before
going to my keyboard.
Best regards
P. Jacquot
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 from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-sql@postgresql.org
Cc: patrick.jacquot@anpe.fr
Subject: Re: [SQL] found a way to update a table with data from another one
In-Reply-To: <3844EB46.EDFA7129@anpe.fr>
References: <20827.943975363@sss.pgh.pa.us> <3844EB46.EDFA7129@anpe.fr>
* 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