cmptrwz

dump vr formats

Apr 24th, 2014
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. SELECT
  2.     bre.id,
  3.     bre.create_date,
  4.     array_agg(DISTINCT SUBSTRING(mrfr007.value FROM '^v...(.)') ORDER BY SUBSTRING(mrfr007.value FROM '^v...(.)')) AS distinct_vr_formats,
  5.     COUNT(DISTINCT mrfr007.id) AS total_vr_format_count
  6. FROM metabib.real_full_rec mrfr007
  7. JOIN biblio.record_entry bre ON mrfr007.record = bre.id
  8. WHERE mrfr007.tag = '007' AND NOT bre.deleted AND mrfr007.value LIKE 'v____%'
  9. AND substring(mrfr007.value FROM '^v...(.)') NOT IN ('|',' ','-')
  10. GROUP BY 1,2
  11. HAVING array_agg(distinct substring(mrfr007.value FROM '^v...(.)') ORDER BY substring(mrfr007.value FROM '^v...(.)')) NOT IN ('{s}','{v}','{s,v}','{b}')
  12. ORDER BY 3, 2 DESC
Add Comment
Please, Sign In to add comment