trying to do an update a bit confused. - Mailing list pgsql-sql

From Joel Fradkin
Subject trying to do an update a bit confused.
Date
Msg-id 000001c544e8$ef28d820$797ba8c0@jfradkin
Whole thread Raw
Responses Re: trying to do an update a bit confused.
List 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

 

 

 

pgsql-sql by date:

Previous
From: Stephan Szabo
Date:
Subject: Re: "Money" Data Type Problem
Next
From: "Jeff Eckermann"
Date:
Subject: Re: Query about SQL in PostgreSQL