Hello All,
i have two table let say "Loan" and "LoanRepayment", here for detail:
Loan:
-------------------------
loan_id | amount |
-------------------------
1 | 2000 |
2 | 3000 |
-------------------------
LaonRepayment:
-------------------------------------------------
payment_id | loan_id | total_payment |
-------------------------------------------------
1 | 1 | 50 |
2 | 1 | 1000 |
3 | 2 | 1500 |
-------------------------------------------------
- How to get Total Loan use AR ?
in sql i can do "select sum(amount) as total_loan from Loan".
- How to get Total Repayment ?
in sql in can do "select sum(total_payment) as total_payment from LoanRepayment".
- How to get Loan Balance ?
in sql i can do
"select loan_id,amount-sum(total_payment)
from Loan left join LoanRepayment on Loan.loan_id = LoanRepayment.loan_id
group by TLoan.loan_id"
I still use sql to get 3 conditions, and still have problem when use AR.
thank you