Created
February 17, 2017 21:07
-
-
Save jeff/d8728bed86820e45a2bdbaef95ff1b50 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- display count of circ matrix matchpoints that reference circ duration rules, grouped by org unit. | |
-- include unused circ duration rules (count = 0) | |
SELECT | |
ccmm.org_unit, | |
aou.shortname, | |
COUNT(ccmm.*), | |
crdd.id, | |
crdd.name, | |
CASE WHEN crdd.shrt = crdd.normal THEN NULL | |
ELSE crdd.shrt | |
END, | |
crdd.normal, | |
CASE WHEN crdd.extended = crdd.normal THEN NULL | |
ELSE crdd.extended | |
END, | |
crdd.max_renewals | |
FROM config.rule_circ_duration crdd | |
LEFT JOIN config.circ_matrix_matchpoint ccmm ON ccmm.duration_rule = crdd.id | |
LEFT JOIN actor.org_unit aou ON ccmm.org_unit = aou.id | |
GROUP BY ccmm.org_unit, aou.shortname, crdd.id, crdd.name, crdd.extended, crdd.normal, crdd.shrt, crdd.max_renewals | |
ORDER BY ccmm.org_unit, crdd.normal, crdd.max_renewals, crdd.id; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment