Advertisement
roganhamby

Investigating Holds

Jul 8th, 2015
300
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  select * from biblio.record_entry where fingerprint ilike '%american%' and fingerprint ilike '%sniper%';
  2.  
  3. SELECT ahr.id, ahr.request_time, ahr.capture_time, ahr.fulfillment_time, ahr.cancel_time,
  4. ahr.current_copy, aou.shortname as pickup_lib, ahr.usr FROM ACTION.hold_request ahr
  5. JOIN (
  6.         SELECT bre.id, 'T' AS hold_type FROM biblio.record_entry bre WHERE bre.id = 2686225
  7.         UNION ALL
  8.         SELECT acn.id, 'V' AS hold_type FROM asset.call_number acn JOIN biblio.record_entry bre ON bre.id = acn.record
  9.         JOIN actor.org_unit aou ON aou.id = acn.owning_lib WHERE aou.shortname ILIKE 'DCL%' AND bre.id = 2686225
  10.         UNION ALL
  11.         SELECT ac.id, 'C' AS hold_type FROM asset.COPY ac JOIN asset.call_number acn ON acn.id = ac.call_number
  12.         JOIN biblio.record_entry bre ON bre.id = acn.record JOIN actor.org_unit aou ON aou.id = acn.owning_lib
  13.         WHERE aou.shortname ILIKE 'DCL%' AND bre.id = 2686225
  14.         UNION ALL
  15.         SELECT mm.id, 'M' AS hold_type FROM metabib.metarecord mm
  16.         JOIN biblio.record_entry bre ON bre.fingerprint = mm.fingerprint WHERE bre.id = 2686225
  17.         ) holds ON holds.id = ahr.target
  18. JOIN actor.org_unit aou ON aou.id = ahr.pickup_lib
  19. WHERE holds.hold_type = ahr.hold_type AND aou.shortname ILIKE 'DCL%'
  20. AND ahr.target = 2686225 AND ahr.hold_type = 'T' ORDER BY ahr.request_time;
  21.  
  22. /*
  23. SELECT acirc.id, acirc.usr, acirc.xact_start, acirc.xact_finish, acirc.unrecovered, acirc.target_copy,
  24. aou.shortname as circ_lib, aou2.shortname as checkin_lib, acirc.due_date, acirc.stop_fines_time,
  25. acirc.checkin_time, acirc.create_time
  26. FROM action.circulation acirc
  27. JOIN actor.org_unit aou ON aou.id = acirc.circ_lib
  28. JOIN actor.org_unit aou2 on aou2.id = acirc.checkin_lib
  29. JOIN asset.COPY ac ON ac.id = acirc.target_copy
  30. JOIN asset.call_number acn ON acn.id = ac.call_number
  31. WHERE aou.shortname ILIKE 'DCL%' AND acn.record = 2686225 ORDER BY xact_start;
  32. */
  33.  
  34.  
  35. SELECT ac.id as copy_id, aou.shortname as circ_lib, ac.create_date, ccs.name as status, ac.active_date
  36. FROM asset.COPY ac
  37. JOIN asset.call_number acn ON acn.id = ac.call_number
  38. JOIN actor.org_unit aou ON aou.id = ac.circ_lib
  39. JOIN config.copy_status ccs on ccs.id = ac.status
  40. WHERE acn.record = 2686225 AND aou.shortname ILIKE 'DCL%'
  41. ;
  42.  
  43. /*
  44. SELECT ac.id as copy_id, ac.audit_time, ac.audit_action,
  45. aou.shortname as circ_lib, ac.create_date, ccs.name as status, ac.active_date
  46. FROM auditor.asset_copy_history ac
  47. JOIN asset.call_number acn ON acn.id = ac.call_number
  48. JOIN actor.org_unit aou ON aou.id = ac.circ_lib
  49. JOIN config.copy_status ccs on ccs.id = ac.status
  50. WHERE acn.record = 2686225 AND aou.shortname ILIKE 'DCL%'
  51. order by 1, 2 desc
  52. ;
  53. */
  54.  
  55. select acirc.xact_start, acirc.xact_finish, acirc.unrecovered, acirc.target_copy,
  56. aou.shortname as circ_lib, aou2.shortname as checkin_lib from action.circulation acirc
  57. join actor.org_unit aou on aou.id = acirc.circ_lib
  58. join actor.org_unit aou2 on aou2.id = acirc.checkin_lib
  59. where target_copy = 5157639 order by acirc.id desc;
  60.  
  61.  
  62. select * from actor.org_unit where shortname ilike 'dcl%';
  63.  
  64. select * from auditor.actor_usr_history where id = 2242297 order by audit_id desc;
  65.  
  66. select * from money.billable_xact_summary where usr = 2242297;
  67.  
  68. select * from action.hold_request where
  69. date(request_time) <= '2015-08-31' and date(fulfillment_time) >= '2015-08-31' and usr = 2242297;
  70.  
  71. select * from actor.card where usr = 2242297;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement