[Koha] Inactive borrowers report

Cab Vinton bibliwho at gmail.com
Thu May 17 06:39:12 NZST 2012


The SQL Reports Library contains a couple of reports for inactive borrowers:

http://wiki.koha-community.org/wiki/SQL_Reports_Library#Inactive_Borrowers
SELECT DISTINCT borrowers.surname, borrowers.firstname,
borrowers.cardnumber, borrowers.email
FROM borrowers
WHERE NOT EXISTS (SELECT borrowernumber FROM statistics WHERE
borrowers.borrowernumber = borrowernumber AND statistics.datetime >=
'YYYY-MM-DD')

http://wiki.koha-community.org/wiki/SQL_Reports_Library#Patrons_with_No_Checkouts
SELECT surname, firstname, cardnumber
FROM borrowers
WHERE borrowernumber NOT IN
     (SELECT DISTINCT borrowernumber
      FROM statistics
      WHERE type = 'issue' AND
      datetime BETWEEN <<Between (yyyy-mm-dd)>> AND <<and (yyyy-mm-dd)>>)

I'd like to modify either of these to create a report that includes
the last date of activity for each patron inactive since a given date
(last activity is an item either being checked in or returned).

Anyone have pointers on how to achieve this? It's beyond my current
minimal level of SQL-fu.

Many thanks,

Cab Vinton, Director
Sanbornton Public Library
Sanbornton, NH

Life is short. Read fast!


More information about the Koha mailing list