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 _______________________________________________ Koha mailing list http://koha-community.org Koha@lists.katipo.co.nz http://lists.katipo.co.nz/mailman/listinfo/koha