trying to do an update a bit confused.

From: "Joel Fradkin" <jfradkin(at)wazagua(dot)com>
To: <pgsql-sql(at)postgresql(dot)org>
Subject: trying to do an update a bit confused.
Date: 2005-04-19 14:06:07
Message-ID: 000001c544e8$ef28d820$797ba8c0@jfradkin
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

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)

)

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

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Jeff Eckermann 2005-04-19 14:17:57 Re: Query about SQL in PostgreSQL
Previous Message Stephan Szabo 2005-04-19 13:59:01 Re: "Money" Data Type Problem