[Koha] SQL Help - Add barcode column to SQL query that searches subject keywords

Vinod Kabadi kabadivinod at gmail.com
Thu Aug 25 04:32:05 NZST 2016


Hi Craig Butosi,

There will be many copies for each biblionumber so you want to list out all
the barcodes related to that biblionumber or biblioitemnumber?

If you want every barcode related to that biblioitemnumber then the query
will be as below:

SELECT CONCAT('<a
href=\"/cgi-bin/koha/catalogue/detail.pl?biblionumber=',items.biblionumber,'\">',items.biblionumber,'</a>')
AS bibnumber,
ExtractValue(marcxml,'//datafield[@tag="690"]/subfield[@code>="a"]') AS
'subjects', items.barcode
FROM biblioitems
LEFT JOIN items on items.biblioitemnumber = biblioitems.biblioitemnumber
WHERE ExtractValue(marcxml,'//datafield[@tag="690"]/subfield[@code>="a"]')
LIKE <<Enter keyword surrounded BY %>> and
biblioitems.biblioitemnumber  is not null
GROUP BY items.biblionumber

On Aug 17, 2016 5:30 AM, <koha-request at lists.katipo.co.nz> wrote:

> Send Koha mailing list submissions to
>         koha at lists.katipo.co.nz
>
> To subscribe or unsubscribe via the World Wide Web, visit
>         https://lists.katipo.co.nz/mailman/listinfo/koha
> or, via email, send a message with subject or body 'help' to
>         koha-request at lists.katipo.co.nz
>
> You can reach the person managing the list at
>         koha-owner at lists.katipo.co.nz
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of Koha digest..."
>
>
> Today's Topics:
>
>    1. Re: Koha for beginners (Mehvish Farah)
>    2. Re: Using perl module Koha::Contrib::Tamil koha-auth
>       (Pedro Amorim)
>    3. SQL Help - Add barcode column to SQL query that searches
>       subject keywords (Craig Butosi)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Tue, 16 Aug 2016 00:50:59 -0700
> From: Mehvish Farah <mehvishfarah at gmail.com>
> To: "King, Fred" <Fred.King at medstar.net>
> Cc: "koha at lists.katipo.co.nz" <koha at lists.katipo.co.nz>
> Subject: Re: [Koha] Koha for beginners
> Message-ID:
>         <CAFL5uZA9Tx_9nnm+99o-GUiz=GLW7ipAXwx25zpvFzdDCMcoEQ at mail.gm
> ail.com>
> Content-Type: text/plain; charset=UTF-8
>
> Thank you very much everyone, This community is awesome. I appreciate all
> who gave me a sense of what MARC is
> , although I still need to read the links that you guys have posted.
>
> Fred, I hope your mom feels better soon. Just in the morning, I felt dizzy
> after reading about MARC. My head was spinning until i took a short nap.Its
> a relief that MARC was at least not her reason for being in the hospital.
>  I would try to browse about z39.50 and OCLC once i finish reading the link
> by all of you.
> Thank you Indranil for your book suggestion. and everyone else with your
> suggesting me for bilinguals code. that's really helpful.
>
>
>
> On Mon, Aug 15, 2016 at 3:19 PM, King, Fred <Fred.King at medstar.net> wrote:
>
> > Hi Mehvish, and welcome to Koha. I tried to explain MARC tags to my
> mother
> > last night and she fell asleep. I think that being in a hospital
> emergency
> > room late at night right after a hefty dose of Dilaudid may have had
> > something to do with it... (She'll be okay, BTW.)
> >
> > MARC is complicated, but makes sense after a while. Think of all the
> > various ways you can describe a book, musical recording, film, etc.
> Author,
> > publisher, year published, length, ISBN, ISSN, call number... well, you
> get
> > the idea. Now give each element a number. For example, the title goes in
> > the 245 field. The main part of the title goes into 245$a. If the book is
> > "Arnold. The tale of a chipmunk" the second part goes into 245$
> > somethingelseicantrememberbutmigjtbeb. Do that for every element you
> want
> > to describe and you got yourself a MARC record. You don't have to do
> > original cataloging on everything; see OCLC and Z39.50. I'm typing this
> on
> > my iPhone so I'll let someone else explain those--my thumb is getting
> weary.
> >
> > One thing I love about Koha is that it's infinitely customizable (yes,
> > literally). If you want to add or change something, you can. All the real
> > catalogers just turned green upon reading that, but you can.
> >
> > I'm away from work right now and I'm astonished that I can get email at
> > all, but I can follow up next week if you want.
> >
> > Have fun with Koha,
> >
> > Fred King
> > Fred.king at medstar.net
> >
> >
> >
> > Sent with Good (www.good.com)
> >
> >
> > -----Original Message-----
> > *From: *Mehvish Farah [mehvishfarah at gmail.com]
> > *Sent: *Monday, August 15, 2016 01:25 PM Eastern Standard Time
> > *To: *koha at lists.katipo.co.nz
> > *Subject: *[Koha] Koha for beginners
> >
> > Hi,
> > I am new to Koha and have no library science experience.
> > I am trying to understand MARC but stuck at the terms where there are
> some
> > numbers with a dollar sign and then an alphabet. What is this basically?
> > I would be grateful if someone can help me with a book or link that helps
> > understand these terms or library/koha terms in general or in easy
> > comprehension.
> >
> > other thing that i want to know is if a book is bilingual (Spanish and
> > English or Arabic and English) , what should i write in Lnaguage code
> > clumn?
> >
> > Thanks
> > *Mehvish*
> > _______________________________________________
> > Koha mailing list  http://koha-community.org
> > Koha at lists.katipo.co.nz
> > https://lists.katipo.co.nz/mailman/listinfo/koha
> >
> > ------------------------------
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> > MedStar Health is a not-for-profit, integrated healthcare delivery
> system,
> > the largest in Maryland and the Washington, D.C., region. Nationally
> > recognized for clinical quality in heart, orthopaedics, cancer and GI.
> >
> > IMPORTANT: This e-mail (including any attachments) may contain
> information
> > that is private, confidential, or protected by attorney-client or other
> > privilege. If you received this e-mail in error, please delete it from
> your
> > system without copying it and notify sender by reply e-mail, so that our
> > records can be corrected... Thank you.
> >
> > Help conserve valuable resources - only print this email if necessary.
> >
> >
>
>
> --
> *Mehvish*
>
>
> ------------------------------
>
> Message: 2
> Date: Tue, 16 Aug 2016 14:40:20 +0000
> From: Pedro Amorim <pjamorim91 at gmail.com>
> To: Frédéric Demians <f.demians at tamil.fr>, Koha list
>         <koha at lists.katipo.co.nz>
> Subject: Re: [Koha] Using perl module Koha::Contrib::Tamil koha-auth
> Message-ID:
>         <CALWP7TK43Ja_VjQpWNcwhDgL2UNJbQ_qCb=L=JGbHiT0rYH59w at mail.
> gmail.com>
> Content-Type: text/plain; charset=UTF-8
>
> Hello Frédéric !
>
> Thank you so much for replying my questions.
>
> 1) Yes '353.9(469)(094.4)' is supposed to be an authority that was just an
> example - 'Wilkens, H. J.' is another example.
> I think they are properly indexed as I can search for those exact terms and
> the results are returned in the intra interface.
>
> 2) Picking up on your comment on having a malformed biblio record, I had
> indeed some very incomplete records with no 6XX or 7XX in them,
> consequently no authorities to link and I thought that may be causing the
> behaviour.
> However, on a different import with all the records having authority info
> to link from, the same error is occurring.
>
> I think I might have figured part of the reason for 1) to be happening.
> In
> https://github.com/fredericd/Koha-Contrib-Tamil/blob/master/
> lib/Koha/Contrib/Tamil/Authority/FromBiblioTask.pm#L74
> Some characters, namely ',', are being stripped from the value and the
> authorities are being saved without the ',' character. Upon running the
> link task, ',' is still present in the biblios so the match fails. Does
> that make sense?
>
> Anyway, I think that's only part of the reason because there are some other
> authorities throwing not found warnings without any of those chars special
> chars.
>
> Yet another possible reason could be encoding causing the match to fail,
> for example 'Ossian, Séc. 3'.
>
> Another (probably) important piece of information is I have a UNIMARC
> installation, is there some particular (indexing) configuration required?
>
> Please let me know if any of this makes sense.
>
> Thank you,
>
> Pedro Amorim
>
>
> 2016-08-13 6:55 GMT+00:00 Frédéric Demians <f.demians at tamil.fr>:
>
> > > 1) For many biblios, the following message is presented:
> > > WARNING: authority not found -- 353.9(469)(094.4)
> >
> > > But said authority indeed exists and is indexed.
> >
> > Is '353.9(469)(094.4)' supposed to be an authority? If it's not found, it
> > means it isn't properly indexed.
> >
> > > 2) After about 400 biblios processed (I think), it throws this error
> and
> > it
> > > hangs printing "405" forever:
> >
> > >
> > > *** unhandled exception in callback:
> > > ***   Quantifier follows nothing in regex; marked by <-- HERE in m/*
> <--
> > > HERE / at
> > > /usr/local/share/perl/5.14.2/Koha/Contrib/Tamil/Authority/Li
> > nkBiblioTask.pm
> > > line 77.
> >
> > You must have a malformed biblio record.
> >
> > Kind regards,
> > --
> > Frédéric DEMIANS
> > http://www.tamil.fr/fdemians
> >
>
>
> ------------------------------
>
> Message: 3
> Date: Tue, 16 Aug 2016 19:50:23 +0000
> From: Craig Butosi <craig.butosi at rcmusic.ca>
> To: "koha at lists.katipo.co.nz" <koha at lists.katipo.co.nz>
> Subject: [Koha] SQL Help - Add barcode column to SQL query that
>         searches subject keywords
> Message-ID:
>         <76B657F0CE544943AD3B3CD99B9C1C055B22EA at RCMMX1.rcmusic.local>
> Content-Type: text/plain; charset="us-ascii"
>
> Hi all,
>
> I'm trying to get the barcodes column from the items database to display
> on the results page after running the following SQL query:
>
> SELECT CONCAT('<a href=\"/cgi-bin/koha/catalogue/detail.pl?biblionumber=',
> biblionumber,'\">',biblionumber,'</a>')
> AS bibnumber, lcsh
> FROM
> (SELECT biblionumber, ExtractValue(marcxml,'//datafi
> eld[@tag="690"]/subfield[@code>="a"]')
> AS lcsh FROM biblioitems)
> AS subjects
> WHERE lcsh
> LIKE <<Enter keyword surrounded BY %>>
> WHERE biblionumber.biblionumber=items.barcode
>
>
> The above I found on the Koha SQL library, but this query only displays
> the biblionumber and keyword query results in 690a. I'd like to add the
> barcodes column to the report. Can't seem figure out how to do this in this
> query. Help, please :)
>
> Many thanks!
>
> C
>
> Craig Butosi, MA, MLIS, B Mus (Hons.)
> LIBRARY SERVICES MANAGER
> the royal conservatory
> TELUS Centre for Performance and Learning
> 273 Bloor Street West
> Toronto, ON M5S 1W2
> 416.408.2824 x338
> www.rcmusic.ca<http://www.rcmusic.ca/>
>
>
>
> Note: This email message and any attachments are intended only for the use
> of the individual to which it is addressed, and may contain information
> that is privileged, confidential and exempt from disclosure under
> applicable law. If the recipient of this email is not the intended
> recipient (or the employee or agent responsible for delivering the email to
> the intended recipient), you are hereby notified that any review,
> dissemination, distribution or copying or other use of this message is
> strictly prohibited. If you have received this communication in error,
> please notify the sender immediately by return email and delete this
> message and attachments from your system, thank you.
>
>
> ------------------------------
>
> Subject: Digest Footer
>
> _______________________________________________
> Koha mailing list
> Koha at lists.katipo.co.nz
> https://lists.katipo.co.nz/mailman/listinfo/koha
>
>
> ------------------------------
>
> End of Koha Digest, Vol 130, Issue 35
> *************************************
>


More information about the Koha mailing list