Advertisement
roganhamby

Statistical Overview

Mar 7th, 2016
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. select aou.id, aou.parent_ou, aou.shortname, aou.ou_type, aou.name, aoa.street1, aoa.street2, aoa.city, aoa.county, aoa.state, aoa.post_code
  3. from actor.org_unit aou join actor.org_address aoa on aoa.id = aou.mailing_address;
  4.  
  5. select * from actor.org_unit_type;
  6.  
  7. select * from permission.grp_tree;
  8.  
  9. -- holds data
  10. SELECT COUNT(ahr.id) AS holds, ahr.pickup_lib, ac.circ_lib AS source_lib,
  11. ac.circ_modifier, acl.name as location, EXTRACT(MONTH FROM ahr.request_time) AS MONTH,
  12. EXTRACT(YEAR FROM ahr.request_time) AS YEAR, au.profile as usr_profile
  13. FROM ACTION.hold_request ahr
  14. JOIN actor.usr au ON au.id = ahr.usr
  15. JOIN asset.COPY ac ON ac.id = ahr.current_copy
  16. JOIN asset.copy_location acl ON acl.id = ac.LOCATION
  17. where ahr.fulfillment_time is not null
  18. GROUP BY 2, 3, 4, 5, 6, 7, 8;
  19.  
  20. -- circ data
  21. SELECT COUNT(acirc.id) AS circs, acirc.circ_lib, ac.circ_modifier, acl.name AS LOCATION,
  22. EXTRACT(MONTH FROM acirc.xact_start) AS MONTH, EXTRACT(YEAR FROM acirc.xact_start) AS YEAR, au.profile AS usr_profile
  23. FROM ACTION.circulation acirc
  24. JOIN asset.COPY ac ON ac.id = acirc.target_copy
  25. JOIN actor.org_unit aou ON aou.id = acirc.circ_lib
  26. JOIN rogan.statistical_years y ON y.id = 6
  27. JOIN asset.copy_location acl ON acl.id = ac.LOCATION
  28. JOIN actor.usr au ON au.id = acirc.usr
  29. GROUP BY 2, 3, 4, 5, 6, 7;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement