X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 7EA2A53429 for ; Tue, 19 Apr 2005 11:06:02 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 90725-02 for ; Tue, 19 Apr 2005 14:05:57 +0000 (GMT) Received: from vms046pub.verizon.net (vms046pub.verizon.net [206.46.252.46]) by svr1.postgresql.org (Postfix) with ESMTP id 13E0D5343C for ; Tue, 19 Apr 2005 11:05:56 -0300 (ADT) Received: from jfradkin ([63.162.100.127]) by vms046.mailsrvcs.net (Sun Java System Messaging Server 6.2 HotFix 0.04 (built Dec 24 2004)) with ESMTPA id <0IF700ITY5U0FRAB@vms046.mailsrvcs.net> for pgsql-sql@postgresql.org; Tue, 19 Apr 2005 09:06:00 -0500 (CDT) Date: Tue, 19 Apr 2005 10:06:07 -0400 From: "Joel Fradkin" Subject: trying to do an update a bit confused. To: Message-id: <000001c544e8$ef28d820$797ba8c0@jfradkin> MIME-version: 1.0 X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 X-Mailer: Microsoft Outlook, Build 10.0.6626 Content-type: multipart/alternative; boundary="----=_NextPart_000_0001_01C544C7.68173820" Importance: Normal X-Priority: 3 (Normal) X-MSMail-priority: Normal X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.001 tagged_above=0 required=5 tests=AWL, HTML_MESSAGE X-Spam-Level: X-Archive-Number: 200504/287 X-Sequence-Number: 21180 This is a multi-part message in MIME format. ------=_NextPart_000_0001_01C544C7.68173820 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit 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 ------=_NextPart_000_0001_01C544C7.68173820 Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable

update tblcase  set merchandisetotal =3D =

(

COALESCE(( SELECT sum(m.quantity::numeric * m.amount) = AS merchandiseamount

         =   FROM tblmerchandise m

         = WHERE m.caseid =3D tblcase.caseid AND m.clientnum::text =3D 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

 

 

 

------=_NextPart_000_0001_01C544C7.68173820--