I used below select query to select information from two tables. But it show one record. How to change this code to view all records ?
select
loan.loan_id,
loan.customer_name,
loan.total_amount,
ifnull(sum(settlement.amount), 0) as 'Total Received',
((loan.total_amount) - ifnull(sum(settlement.amount), 0)) as 'Total Due'
from loan
left join settlement on
settlement.loan_id = loan.loan_id
where
loan.collector_name='kapoor'
There are two loans which are collected by kapoor. But it show one record.
Guys help me .......