Advertisement
Guest User

Untitled

a guest
Sep 18th, 2016
230
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
SQL 1.33 KB | None | 0 0
  1. SELECT  aac_copy_owning_lib."shortname" AS "Owning Library",
  2.         aac_target_copy_call_number."label" AS "Call Number",
  3.         rmsr."title" AS "Title",
  4.         COUNT(aac."id") AS "Circ Count"
  5.   FROM  action.all_circulation AS aac
  6.         INNER JOIN actor.org_unit AS aac_copy_owning_lib ON (aac."copy_owning_lib" = aac_copy_owning_lib."id")
  7.         INNER JOIN biblio.record_entry AS aac_copy_bib_record ON (aac."copy_bib_record" = aac_copy_bib_record."id")
  8.         INNER JOIN metabib.rec_descriptor AS mrd ON (aac_copy_bib_record."id" = mrd."record")
  9.         INNER JOIN config.item_type_map AS citm ON (mrd."item_type" = citm."code")
  10.         INNER JOIN config.item_form_map AS cifm ON (mrd."item_form" = cifm."code")
  11.         INNER JOIN reporter.materialized_simple_record AS rmsr ON (aac_copy_bib_record."id" = rmsr."id")
  12.         INNER JOIN asset.copy AS aac_target_copy ON (aac."target_copy" = aac_target_copy."id")
  13.         INNER JOIN asset.call_number AS aac_target_copy_call_number ON (aac_target_copy."call_number" = aac_target_copy_call_number."id")
  14.   WHERE aac_copy_owning_lib."id" IN ('156','157','158','159','160','161','351','162')
  15.         AND citm."code" = 'i'
  16.         AND cifm."code" = 'q'
  17.   GROUP BY 1, 2, 3
  18.   ORDER BY aac_copy_owning_lib."shortname" ASC, aac_target_copy_call_number."label" ASC, rmsr."title" ASC, COUNT(aac."id") ASC
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement