On 4/19/05, Joel Fradkin <[EMAIL PROTECTED]> 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 ;)

---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

               http://www.postgresql.org/docs/faq

Reply via email to