Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- SELECT DISTINCT(record),
- COALESCE(n72.quality, 0) + COALESCE(n73.quality, 0) + COALESCE(n74.quality, 0) + COALESCE(n75.quality, 0) + COALESCE(n76.quality, 0) + COALESCE(n77.quality, 0) AS quality
- FROM
- (SELECT *, 2 AS quality FROM metabib.full_rec mfr WHERE mfr.tag = '020' AND mfr.subfield = 'a' AND (LOWER(mfr.value) LIKE '9781492629887%' OR LOWER(mfr.value) LIKE '149262988x%')) n72
- FULL OUTER JOIN (SELECT *, 2 AS quality FROM metabib.full_rec mfr WHERE mfr.tag = '022' AND mfr.subfield = 'a' AND (LOWER(mfr.value) LIKE NULL)) n73 USING (record)
- FULL OUTER JOIN (SELECT *, 2 AS quality FROM metabib.full_rec mfr WHERE mfr.tag = '024' AND mfr.subfield = 'a' AND (LOWER(mfr.value) LIKE NULL)) n74 USING (record)
- FULL OUTER JOIN (SELECT *, 2 AS quality FROM metabib.full_rec mfr WHERE mfr.tag = '028' AND mfr.subfield = 'a' AND (mfr.value = NULL)) n75 USING (record)
- FULL OUTER JOIN (SELECT *, id AS record, 16 AS quality FROM metabib.record_attr_flat mraf WHERE mraf.attr = 'bib_level' AND mraf.value = $2->'bib_level') n76 USING (record)
- FULL OUTER JOIN (SELECT *, id AS record, 16 AS quality FROM metabib.record_attr_flat mraf WHERE mraf.attr = 'item_type' AND mraf.value = $2->'item_type') n77 USING (record)
- JOIN biblio.record_entry bre ON (bre.id = record)
- WHERE (((n72.id IS NOT NULL) OR (n73.id IS NOT NULL) OR (n74.id IS NOT NULL) OR (n75.id IS NOT NULL)) AND (n76.id IS NOT NULL) AND (n77.id IS NOT NULL)) AND not bre.deleted
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement