Advertisement
Guest User

uniqueccpl1

a guest
Sep 8th, 2011
141
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.64 KB | None | 0 0
  1. SELECT borrowers.cardnumber, borrowers.surname, borrowers.firstname, borrowers.address, borrowers.city, borrowers.zipcode, borrowers.email, borrowers.phone, borrowers.dateofbirth, borrowers.debarred, borrowers.categorycode, accountlines.date,
  2. FORMAT(SUM(accountlines.amountoutstanding),2) AS Due
  3. FROM borrowers, accountlines
  4. WHERE borrowers.categorycode IN ('CCPLSTAFF','IN','LIMITED','NONRES','RESIDENT','ROTARY') AND accountlines.date > DATE_SUB(CURDATE(),INTERVAL 60 DAY)
  5. AND borrowers.borrowernumber = accountlines.borrowernumber
  6. GROUP BY borrowers.borrowernumber
  7. HAVING SUM(accountlines.amountoutstanding) > 24.99
  8. ORDER BY borrowers.surname ASC;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement