Skip to content

Instantly share code, notes, and snippets.

@jeff
Created May 18, 2011 16:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jeff/978925 to your computer and use it in GitHub Desktop.
Save jeff/978925 to your computer and use it in GitHub Desktop.
sql for Evette
-- revised to use a sub-select and to report only those records with BOTH a
-- matching 856$3 and 856$9 -- this sub-select may not be the most efficient way
-- to do this. also eliminated tag/subfield/value from the output
SELECT au.usrname, bre.tcn_value, bre.id, bre.create_date,
bre.edit_date
FROM metabib.real_full_rec as mrfr
LEFT JOIN biblio.record_entry as bre on bre.id = mrfr.record
LEFT JOIN actor.usr as au on au.id = bre.editor
WHERE bre.deleted = 'f'
AND mrfr.tag = '856'
AND
(mrfr.subfield='3'
AND mrfr.value like '%excerpt%')
AND mrfr.record IN
(SELECT record from metabib.real_full_rec WHERE tag='856' AND subfield='9' AND UPPER(value) LIKE '%NDL%')
ORDER BY au.usrname, bre.id;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment