SELECT Trans.yReferral_balance_amount, Trans.yCurrent_balance_amount, ; (SELECT SUM(Payments.yAmount_Paid) as yBalance ; FROM Payments inner join Trans Trans1 ; on Payments.cTrans_fk = Trans1.cTrans_pk ; WHERE Payments.cTrans_fk = Trans.cTrans_pk ; and Payments.dPosting_date > Trans1.tDate_received) ; as yTotalPayments ; FROM TRANS ; WHERE Trans.cResolution_Codes_fk is NULL into cursor curAllBalances nofilterThe Calculated balance equals Referral Balance - All payments after received date.