Skip to content

Instantly share code, notes, and snippets.

@xmorave2
Last active June 20, 2016 06:29
Show Gist options
  • Save xmorave2/936c3fdd24d8a1105c018dd4c331006c to your computer and use it in GitHub Desktop.
Save xmorave2/936c3fdd24d8a1105c018dd4c331006c to your computer and use it in GitHub Desktop.
UPDATE biblio b JOIN biblioitems bi ON b.biblionumber = bi.biblionumber
SET b.copyrightdate = SUBSTRING(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(ExtractValue(bi.marcxml, '//datafield[@tag="264"]/subfield[@code="c"]'), "[", ""), "]", ""), "?", ""), "c", ""), "©", ""), "℗", ""), -4)
WHERE copyrightdate IS NULL AND frameworkcode = "KN";
SELECT b.frameworkcode, b.biblionumber, b.copyrightdate,
SUBSTRING(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(ExtractValue(bi.marcxml, '//datafield[@tag="264"]/subfield[@code="c"]'), "[", ""), "]", ""), "?", ""), "c", ""), "©", ""),"℗", ""), -4) as year
FROM biblio b JOIN biblioitems bi ON b.biblionumber = bi.biblionumber
WHERE copyrightdate IS NULL
LIMIT 10;
SELECT frameworkcode, count(*) FROM biblio WHERE copyrightdate IS NULL GROUP BY frameworkcode;
SELECT frameworkcode, count(*) FROM biblio WHERE copyrightdate = 0 GROUP BY frameworkcode;
UPDATE biblio SET copyrightdate = NULL WHERE copyrightdate = 0;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment