Skip to content

Instantly share code, notes, and snippets.

@xmorave2
Created October 15, 2020 06:41
Show Gist options
  • Save xmorave2/51fdadf88e261e18834ffb5553691917 to your computer and use it in GitHub Desktop.
Save xmorave2/51fdadf88e261e18834ffb5553691917 to your computer and use it in GitHub Desktop.
SELECT b.title,
ExtractValue(bm.metadata, '//datafield[@tag="787"]/subfield[@code="t"]') AS 787t,
ExtractValue(bm.metadata, '//datafield[@tag="787"]/subfield[@code="g"]') AS 787g,
CONCAT_WS("", "<a class='btn btn-default btn-xs' href='/cgi-bin/koha/cataloguing/addbiblio.pl?biblionumber=", b.biblionumber, "'><i class='fa fa-pencil'></i> Upravit záznam</a>") as Upravit
FROM biblio b
JOIN biblio_metadata bm ON b.biblionumber = bm.biblionumber
WHERE ExtractValue(bm.metadata, '//datafield[@tag="787"]/subfield[@code="t"]') != ''
AND ExtractValue(bm.metadata, '//datafield[@tag="787"]/subfield[@code="g"]') NOT REGEXP '^[[:digit:] ]+$'
ORDER BY 787g DESC
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment