>>And every record in Trans may or may not have records in payments or charges.
>
>Then make those both left joins instead of inner joins, and use nvl()... like this:
>
>
>Select Trans.cTrans_fk, Sum(nvl(Payments.yAmount_paid,0)) as yAmount_paid, ;
> Sum(nvl(Charges.yCharges_amount,0)) as yCharges_amount ;
> from Trans ;
> left join Payments ;
> on Trans.cTrans_pk = Payments.cTrans_fk ;
> left join Charges ;
> on Trans.cTrans_pk = Charges.cTrans_fk ;
> group by 1
>
>With inner joins you see only transactions where you have records in all three tables for a given transaction.
I believe it's a solution to the problem except that you probably need to put 0000000000.00 (as many 0 as the final field should be).
UPDATE. But it turned out I was wrong and the query doesn't work correctly.
If it's not broken, fix it until it is.
My Blog