From: KÖPFERL Robert <robert.koepferl@sonorys.at>
To: pgsql-sql@postgresql.org
Subject: Re: trying to do an update a bit confused.
Date: Tue, 19 Apr 2005 16:43:41 +0200
Message-ID: <ED4E30DD9C43D5118DFB00508BBBA76EB166C0@neptun.sonorys.at> (raw)
You're most probably missing a Where clause after the parentensis. see:
-----Original Message-----
From: Joel Fradkin [mailto:jfradkin@wazagua.com]
Sent: Dienstag, 19. April 2005 16:06
To: pgsql-sql@postgresql.org
Subject: [SQL] trying to do an update a bit confused.
update tblcase set merchandisetotal =
(
COALESCE(( SELECT sum(m.quantity::numeric * m.amount) AS merchandiseamount
FROM tblmerchandise m
WHERE m.caseid = tblcase.caseid AND m.clientnum::text =
tblcase.clientnum::text), 0.0)
)
WHERE <condtion that selects one record>;
I tried running the above and it wants to do a sum on all the records in
tblcase instead of just the one being updated, what am I doing wrong?
Joel Fradkin
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: robert.koepferl@sonorys.at
Subject: Re: trying to do an update a bit confused.
In-Reply-To: <ED4E30DD9C43D5118DFB00508BBBA76EB166C0@neptun.sonorys.at>
References: <ED4E30DD9C43D5118DFB00508BBBA76EB166C0@neptun.sonorys.at>
* 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