SELECT borrowers.surname,borrowers.firstname,issues.date_due, (TO_DAYS(curdate())-TO_DAYS( date_due)) AS 'days overdue', items.itemcallnumber, items.barcode,biblio.title, biblio.author  FROM borrowers LEFT JOIN issues ON (borrowers.borrowernumber=issues.borrowernumber)  LEFT JOIN items ON (issues.itemnumber=items.itemnumber)  LEFT JOIN biblio ON (items.biblionumber=biblio.biblionumber)  WHERE (TO_DAYS(curdate())-TO_DAYS(date_due)) > '30'   ORDER BY borrowers.surname ASC, issues.date_due ASC