Hi Toni,

On Thu, Jan 14, 2010 at 11:42 AM, Toni Rosa <arosa@tgi.es> wrote:
Thanks for your answer, Nicole.
I have another doubt regarding Koha 3.

I've seen that in Koha 3 (and maybe in earlier versions too) the table
"marc_subfield_table" is gone.

Does it mean that it is not possible, anymore, to select a biblio by its
marc subvalues only using SQL?
(Skimming over the code I see in C4/Biblio.pm that the method
GetMarcBiblio loads a new MARC::Record from the values in
biblioitems.marcxml, but that' would be programming, and we have some
SQL queries in use with Koha 2.7 that use the now gone
"marc_subfield_table" table)

MySQL has some XML handling functions:

http://dev.mysql.com/doc/refman/5.4/en/xml-functions.html

For example:

'SELECT ExtractValue((SELECT marcxml FROM biblioitems WHERE biblionumber=14), '//datafield[@tag="952"]/subfield[@code>="a"]') AS ITEM;' returns the entire 952 data for all 952 fields for biblionumber 14 (without delimiting)

'SELECT ExtractValue((SELECT marcxml FROM biblioitems WHERE biblionumber=14), '//datafield[@tag="260"]/subfield[@code>="b"]') AS ITEM;' returns the 260$b data fro biblionumber 14

And so on.

Maybe this will help.

Kind Regards,
Chris