>  select customers.*, ctots.total
>  from customers,
>       (select customer_id cid, sum(invoice_amount) total
>        from invoice_master group by cid) ctots
>  where customers.customer_id = ctots.cid

You're right -- sorry, I wan't paying attention.

For 'customers, (subquery) where' substitute
'customers left join (subquery) on', and
for 'ctots.total' subsitute 'coalesce(ctots.total, 0.00)'.

select customers.*, coalesce(ctots.total, 0.00)
from customers left join
     (select customer_id cid, sum(invoice_amount) total
      from invoice_master group by cid) ctots
on customers.customer_id = ctots.cid

Regards

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to