select
borrowers.cardnumber as cardnumber, concat(borrowers.title,' ',
borrowers.firstname,' ',borrowers.surname) as Name, borrowers.email as email,
sum(ROUND(accountlines.amountoutstanding,2)) as amountoutstanding from borrowers
left
join accountlines on borrowers.borrowernumber =accountlines.borrowernumber
where
borrowers.categorycode=<<Enter category borrowers|categorycode>>
and accountlines.amountoutstanding >
0
group by borrowers.borrowernumber
No comments:
Post a Comment