22 Apr
2013
22 Apr
'13
9:18 p.m.
I'm looking to change this report around. It shows patrons with their guarantor information. I want a report that shows me the guarantees for each guarantor instead. SELECT p.categorycode, p.dateofbirth, p.cardnumber, p.surname, p.firstname, p.dateexpiry, IFNULL(concat(g.surname, ', ', g.firstname, ' (', g.cardnumber, ')'),'') AS guarantor, p.relationship, ifnull(FORMAT(SUM(a.amountoutstanding),2),'0.00') AS due FROM borrowers p LEFT JOIN accountlines a USING (borrowernumber) LEFT JOIN borrowers g ON (p.guarantorid=g.borrowernumber) WHERE p.dateexpiry < NOW() GROUP BY p.borrowernumber ORDER BY p.dateexpiry ASC Nicole