[Koha] help with SQL query for the existence of a MARC field?

Jason Vasche jvasche at roundrocktexas.gov
Fri May 10 01:49:34 NZST 2019


Greetings Koha Community!

First-time poster here, I'm fairly new to Koha and SQL.  I've been trying to write a specific report with no luck. Here's what's happening:

We're updating series authorities for our fiction collection.  To start, I need to create a list of all our romance novels that have series fields (490, 8XX).  This query returns the list of all our romance novels:

SELECT biblio.biblionumber, biblio.title
FROM biblio_metadata
JOIN biblio ON (biblio_metadata.biblionumber = biblio.biblionumber)
WHERE ExtractValue (metadata, '//datafield[@tag="092"]/subfield[@code="a"]') = 'ROM'

The obstacle is trying to figure out what syntax to use to indicate the presence of a field (the contents of the field are irrelevant to this task.)  I've tried various AND WHERE and AND EXISTS lines, but I'm fumbling around in the dark.  Can anyone point me in the right direction?  Thanks for your time and attention.

Regards,

Jason Vasché
Catalog Librarian
Round Rock Public Library


More information about the Koha mailing list