Skip to content

Instantly share code, notes, and snippets.

@maheshpalamuttath
Created April 9, 2025 09:06
Show Gist options
  • Select an option

  • Save maheshpalamuttath/06bfb11b1ee5c8bcb7fb9cc79d7688af to your computer and use it in GitHub Desktop.

Select an option

Save maheshpalamuttath/06bfb11b1ee5c8bcb7fb9cc79d7688af to your computer and use it in GitHub Desktop.
SELECT
bi.biblioitemnumber AS `020$a`,
bi.isbn AS `021$a`,
IFNULL(ExtractValue(bm.metadata, '//datafield[@tag="082"]/subfield[@code="a"]'), '') AS `082$a`,
IFNULL(ExtractValue(bm.metadata, '//datafield[@tag="082"]/subfield[@code="b"]'), '') AS `082$b`,
b.author AS `100$a`,
CONCAT(b.title, ' ', IFNULL(ExtractValue(bm.metadata, '//datafield[@tag="245"]/subfield[@code="b"]'), '')) AS `245$a`,
bi.editionstatement AS `250$a`,
bi.place AS `260$a`,
bi.publishercode AS `260$b`,
b.copyrightdate AS `260$c`,
bi.pages AS `300$a`,
i.enumchron AS `490$v`,
IFNULL(ExtractValue(bm.metadata, '//datafield[@tag="650"]/subfield[@code="a"]'), '') AS `650$a`,
IFNULL(ExtractValue(bm.metadata, '//datafield[@tag="700"]/subfield[@code="a"]'), '') AS `700$a`,
i.itype AS `942$c`,
i.withdrawn AS `952$0`,
i.itemlost AS `952$1`,
i.damaged AS `952$4`,
i.ccode AS `952$8`,
i.homebranch AS `952$a`,
i.holdingbranch AS `952$b`,
i.location AS `952$c`,
i.dateaccessioned AS `952$d`,
i.booksellerid AS `952$e`,
i.price AS `952$g`,
i.itemcallnumber AS `952$0`,
i.barcode AS `952$p`,
i.copynumber AS `952$t`,
i.itype AS `952$y`
FROM
items i
LEFT JOIN
biblioitems bi ON (i.biblioitemnumber = bi.biblioitemnumber)
LEFT JOIN
biblio b ON (bi.biblionumber = b.biblionumber)
LEFT JOIN
biblio_metadata bm ON (bm.biblionumber = b.biblionumber)
ORDER BY
i.biblioitemnumber ASC;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment