Navigation

3/01/2015

SQL for holds in ILS

From Sierra Listserv,  post by Andrew Hollingsworth



To get the equivalent you'd need to join at least 8 views. I was working on something similar last year and will include what I had. You'll need to possibly edit it for volumes. I also left out the patron email in the query I used because our var view is just too large. You might have to include a CASE statement for the email. 





Select Distinct
  h.placed_gmt,
  h.expires_gmt,
  prfn.last_name,
  prfn.first_name,
  prfn.middle_name,
  p.record_num,
  prp.phone_number,
  b.title,
  i.call_number_norm,
  h.location_code,
  h.pickup_location_code,
  h.status
From
  sierra_view.hold h Inner Join
  sierra_view.patron_view p On h.patron_record_id = p.id Inner Join
  sierra_view.patron_record_fullname prfn On prfn.patron_record_id = p.id
  Inner Join
  sierra_view.patron_record_phone prp On prfn.patron_record_id =
    prp.patron_record_id Inner Join
  sierra_view.bib_view b On h.record_id = b.id Inner Join
  sierra_view.bib_record_item_record_link birl On b.id = birl.bib_record_id
  Inner Join
  sierra_view.item_record_property i On birl.item_record_id = i.item_record_id

No comments:

Post a Comment