User Tools

Site Tools


evergreen-reports:sql:borrower:statistical_reports

Borrower Statistical Reports

Monthly Borrowers Added by Patron Profile Group and Stat Category

Submission Notes: This report was submitted on 6/10/10 by Amy Terlaga of Bibliomation, Inc. It was created by Dan Scott of Laurentian University. It was modified to include TOTAL.

Version: Evergreen v.1.6.0.2 Data Sources Used: Running Tips/Guidelines: This report shows those borrowers registered in a given month. You filter by organizational unit. You must replace the shortname of your org unit for the 'ORG' you see in the query below. The breakdown is by patron profile group and (if you use) patron statistical category.

Run this report any time in the month directly following the month you would like to capture statistics for.

 SELECT aou.name AS "Library", pgt.name AS "Profile", asceum.stat_cat_entry AS "Residency", COUNT(pgt.name) AS "Count"
   FROM actor.usr au
   JOIN permission.grp_tree pgt ON au.profile = pgt.id
   JOIN actor.org_unit aou ON aou.id = au.home_ou
   LEFT JOIN actor.stat_cat_entry_usr_map asceum ON asceum.target_usr = au.id
  WHERE aou.shortname = **'ORG'**::text AND au.deleted IS FALSE 
  AND date_trunc('MONTH'::text, au.create_date) = date_trunc('MONTH'::text, now() - '1 mon'::INTERVAL) 
  AND (pgt.name <> ALL (ARRAY['Catalogers'::text, 'Circulators'::text, 'Staff'::text, 'Users'::text]))
  GROUP BY aou.name, pgt.name, asceum.stat_cat_entry
 
 UNION
 
 SELECT 'ZZZ Total' AS "Library", '' AS "Profile", '' AS "Residency", COUNT(pgt.name) AS "Count"
   FROM actor.usr au
   JOIN permission.grp_tree pgt ON au.profile = pgt.id
   JOIN actor.org_unit aou ON aou.id = au.home_ou
   LEFT JOIN actor.stat_cat_entry_usr_map asceum ON asceum.target_usr = au.id
  WHERE aou.shortname = **'ORG'**::text AND au.deleted IS FALSE 
  AND date_trunc('MONTH'::text, au.create_date) = date_trunc('MONTH'::text, now() - '1 mon'::INTERVAL) 
  AND (pgt.name <> ALL (ARRAY['Catalogers'::text, 'Circulators'::text, 'Staff'::text, 'Users'::text]))
 
 ORDER BY 1, 2, 3;

Back to Borrower Reports page

evergreen-reports/sql/borrower/statistical_reports.txt · Last modified: 2022/02/10 13:34 by 127.0.0.1

Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 4.0 International
CC Attribution-Share Alike 4.0 International Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki

© 2008-2022 GPLS and others. Evergreen is open source software, freely licensed under GNU GPLv2 or later.
The Evergreen Project is a U.S. 501(c)3 non-profit organization.