SQL to locate items with fewer (or more) than x loans
- Article Type: General
- Product: Aleph
- Product Version: 20
Desired Outcome Goal:
List of books which have fewer (or more) than x loans (for weeding purposes).
Procedure:
1. On server, vi items_with_fewer-more_than_x_loans.sql (it will initially be, non-existent/empty)
2. Paste contents of attached file into items_with_fewer-more_than_x_loans.sql
3. Change "XXXXX" to library's sublibrary code (in uppercase)
4. Edit " HAVING COUNT(*) < '5' ": change sign to ">" or increase/decrease loan-count threshold
5. s+ xxx50
6. SQL> @items_with_fewer-more_than_x_loans.sql
7. View the items_for_weeding.lst output
Additional Information
The z35_event_date could be used to limit the results retrieved to a particular time period.
Note: If the z35 records have been deleted for the time period of interest, the z30_no_loan (the number of loans of the item) column might be used, though that is just a total; no way to look for the number of loans in the past x years.