[Koha] Report help: count of certain subfield values
Kallinen Pasi
Pasi.Kallinen at pttk.fi
Tue Nov 10 20:41:42 NZDT 2015
Hi all,
I've been pondering how to do this report, but haven't found a good solution:
I'd like to have a list of all subfield values for certain subfield from biblioitems, and have counts of the field contents.
For example:
SELECT
count(*),
ExtractValue(marcxml, '//datafield[@tag=<<Field>>]/subfield[@code="<<Subfield>>"]') AS kentta
FROM biblioitems
GROUP BY kentta
ORDER BY count(*), kentta
This works, except when the field or subfield is repeatable, because the values from a single record are concatenated by MySQL, with the values separated by spaces. This means it's impossible to know if the space is a separator between the field values, or part of a field value.
(If only Koha stored the marcxml data in a database-query friendly format too...)
--
Ystävällisin terveisin
Pasi Kallinen
ICT-asiantuntija
p. 050-408 6958
pasi.kallinen at pttk.fi
Pohjois-Karjalan Tietotekniikkakeskus Oy - www.pttk.fi
More information about the Koha
mailing list