with invsas ( select CustKey ,sum(balance) invbalance from tarInvoice group by CustKey ) ,paymentsas ( select CustKey ,Sum(UnappliedAmt) UnappliedAmt from tarCustPmt group by CustKey )select c.CustKey ,c.CustId ,etc etc ,IsNull(invs.invbalance, 0) ,isNull(payments.UnappliedAmt)from tarCustomer cleft join invs on c.CustKey = invs.CustKeyleft join payments on c.CustKey = payments.CustKey