Re: trying to do an update a bit confused.

From: Jaime Casanova <systemguards(at)gmail(dot)com>
To: Joel Fradkin <jfradkin(at)wazagua(dot)com>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: trying to do an update a bit confused.
Date: 2005-04-19 23:03:35
Message-ID: c2d9e70e050419160340f7c31d@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On 4/19/05, Joel Fradkin <jfradkin(at)wazagua(dot)com> wrote:
>
>
>
> 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)
>
> )
>
>

Put the coalesce inside the select:
update tblcase set merchandisetotal =
(SELECT COALESCE(sum(m.quantity::numeric * m.amount),0.0) AS
merchandiseamount
FROM tblmerchandise m
WHERE m.caseid = tblcase.caseid AND m.clientnum::text =
tblcase.clientnum::text)

--
Regards,

DBA* Jaime Casanova
(DBA: DataBase Aniquilator ;)

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Mihail Nasedkin 2005-04-20 02:28:58 Re: Debet-Credit-Balance Calculation
Previous Message Oleg Bartunov 2005-04-19 17:43:02 Re: tsearch2