[Koha] Catalogue - SQL Report Help

Heather Braum (NEKLS) hbraum at nekls.org
Thu Dec 11 07:02:36 NZDT 2014


I find the guided reports wizard, frankly, to be very unhelpful, especially
since I work with 50 branch locations in our consortia. I usually write my
own custom reports, as a result, for much more granular control.

To get this kind of data you gave as an example, you have to query and join
three tables together -- biblio table has the author and title info, the
biblioitems table has the edition, publisher, and isbn (will return up to
30 characters; there's something different you have to use in your query if
you want the full isbn), and then the total items count comes from also
querying the items table.

The SQL statement will look like this:

SELECT DISTINCT b.biblionumber, b.title, b.author, t.editionstatement,
t.publishercode, t.isbn, count(i.itemnumber) FROM biblio b LEFT JOIN
biblioitems t USING(biblionumber) LEFT JOIN items i USING(biblionumber)
GROUP BY b.biblionumber

Does this statement give you what you are looking for?

Heather Braum
NExpress Coordinator
Resource Sharing Librarian
Northeast Kansas Library System
hbraum at nekls.org

"The illiterate of the 21st century will not be those who cannot read
and write, but those who cannot learn, unlearn, and relearn." ~Alvin
Toffler, *Rethinking the Future*




On Wed, Dec 10, 2014 at 11:27 AM, Elaine Bradtke <eb at efdss.org> wrote:

> You have discovered one of the quirks of the system. For biblios with
> multiple items it will produce the same information (title, etc.) for each
> item.  I don't know how to work around that. Maybe someone else does?
>
> Elaine
>
> On Wed, Dec 10, 2014 at 5:12 AM, SATISH <lis4satish at gmail.com> wrote:
>
> > Hi,
> >
> > I would like to have report for the entire library collections as
> > indicated below:
> >
> >
> --------------------------------------------------------------------------------------------------
> > Biblio    | Biblio  Record (title) | Author | edition | publisher | ISBN
> > | Holdings ( no. of copies)
> > Number
> > count
> >
> >
> --------------------------------------------------------------------------------------------------
> >
> > example:
> >
> > 1  Brief history of time    Hawkings.    2nd ed.    oxford    (paper
> > back)    10
> > 2  Brief history of time    Hawkings    3rd ed.    oxford  (paper
> > back)        5
> > 3  Brief history of time    Hawkings    2nd ed.    Oxford  (hard
> > bound)      2
> > 4  Complete reference- C++    ....        ....        ....
> >                                       50
> > 5  Basic electrical engineering    ...        ....        ....
> >                                    30
> >
> >
> >
> --------------------------------------------------------------------------------------------------
> >
> > For example, One record is having 10 items, and when I tried to use
> guided
> > reports wizard, it fetches and display, 10 times the same records. I
> wanted
> > to get only one title on behalf of 10 items. I meant, non-repetative
> > records ( titles) from the entire library collections. (and exceptions
> for
> > change in edition, ISBN, different title).
> >
> >
> > And secondly,
> > the same report as per the collection code, which means,
> > list of unique records in each collection (isbn, change in edition, etc
> > are exceptions).
> >
> > Thank you in advance.
> >
> > Satish MV
> > Librarian
> > Govt. Engineering College, Hassan.
> > Karnataka.
> > INDIA.
> > +91-9449765737
> >
> >
> >
> >
> > On Mon, Dec 8, 2014 at 11:22 PM, Elaine Bradtke <eb at efdss.org> wrote:
> >
> >> More information may help.
> >>
> >> "all unique titles(biblio records)"
> >> Unique how? different ISBN?  (do they all have ISBN?) Different title?
> >> Same title different edition?  Only one item record?
> >>
> >> Exactly what information would you like to display in the report?
> >> List of biblio numbers?
> >> Sorted by collection code?
> >> or Filtered to show only items with a specific collection code?
> >>
> >> It may take a few attempts to make your request clear. I am not an
> expert
> >> report writer, but once you question is better understood, we may be
> able
> >> to help.
> >>
> >>
> >> On Fri, Dec 5, 2014 at 6:20 AM, SATISH <lis4satish at gmail.com> wrote:
> >>
> >>> Hi,
> >>>
> >>> Unfortunately, I have not received any help for generating a report on
> >>> following subject and, re-described my problem.
> >>>
> >>> I am looking for a report which has list of all unique titles(biblio
> >>> records) in a home library AND also by collection code.
> >>> When I tried for nearest relevant SQL examples given in wiki,
> >>> it gives me, whole list of items along with biblios records that is not
> >>> useful and I wanted to have information only on unique records
> (titles).
> >>>
> >>> Please advice.
> >>>
> >>> with thanks.
> >>> Satish MV
> >>> Librarian
> >>> Govt. Engineering College, Hassan.
> >>> Karnataka.
> >>> INDIA.
> >>>
> >>> On Tue, Nov 25, 2014 at 4:58 PM, SATISH <lis4satish at gmail.com> wrote:
> >>>
> >>> > Koha 3.16.00.000 installed via packages method, on ubuntu desktop.
> >>> >
> >>> > On Tue, Nov 25, 2014 at 4:22 PM, vikram zadgaonkar <
> >>> > vikramczadgaonkar at gmail.com> wrote:
> >>> >
> >>> >> Ok. Let me check. I will mail you SQL query.
> >>> >> Which koha version you are using?
> >>> >>
> >>> >> Vikram Zadgaonkar
> >>> >>
> >>> >> On Tue, Nov 25, 2014 at 4:20 PM, SATISH <lis4satish at gmail.com>
> wrote:
> >>> >>
> >>> >>> The same is not available over there.
> >>> >>> Many examples in the website, fetches for whole items in the
> library.
> >>> >>> I need to have report on List of Unique titles available in the
> >>> library
> >>> >>> ( i.e., Records) and Total Number of books (i.e.,Items).
> >>> >>> report should include list of {title,author,publisher,edition,
> price}
> >>> >>> not just counts.
> >>> >>>
> >>> >>>
> >>> >>> On Tue, Nov 25, 2014 at 1:40 PM, vikram zadgaonkar <
> >>> >>> vikramczadgaonkar at gmail.com> wrote:
> >>> >>>
> >>> >>>> Hi,
> >>> >>>> You can try following link
> >>> >>>> http://wiki.koha-community.org/wiki/SQL_Reports_Library
> >>> >>>>
> >>> >>>> Vikram Zadgaonkar
> >>> >>>>
> >>> >>>> On Tue, Nov 25, 2014 at 1:33 PM, satishamv <lis4satish at gmail.com>
> >>> >>>> wrote:
> >>> >>>>
> >>> >>>>> Dear Friends,
> >>> >>>>> I am looking for a report which has list of all unique
> >>> titles(biblio
> >>> >>>>> records) in a home library AND also by collection code.
> >>> >>>>> In my case, new record is created for - change in edition or
> >>> change in
> >>> >>>>> item
> >>> >>>>> type.
> >>> >>>>>
> >>> >>>>>
> >>> >>>>>
> >>> >>>>> with thanks.
> >>> >>>>> Satish MV
> >>> >>>>> Librarian
> >>> >>>>> Govt. Engineering College, Hassan.
> >>> >>>>> Karnataka.
> >>> >>>>> INDIA.
> >>> >>>>>
> >>> >>>>>
> >>> >>>>>
> >>> >>>>> --
> >>> >>>>> View this message in context:
> >>> >>>>>
> >>>
> http://koha.1045719.n5.nabble.com/Catalogue-SQL-Report-Help-tp5820185.html
> >>> >>>>> Sent from the Koha-general mailing list archive at Nabble.com.
> >>> >>>>> _______________________________________________
> >>> >>>>> Koha mailing list  http://koha-community.org
> >>> >>>>> Koha at lists.katipo.co.nz
> >>> >>>>> http://lists.katipo.co.nz/mailman/listinfo/koha
> >>> >>>>>
> >>> >>>>
> >>> >>>>
> >>> >>>
> >>> >>>
> >>> >>> --
> >>> >>>
> >>> >>>
> >>> >>>
> >>> >>>
> >>> >>
> >>> >
> >>> >
> >>> > --
> >>> >
> >>> >
> >>> >
> >>> >
> >>>
> >>>
> >>> --
> >>> _______________________________________________
> >>> Koha mailing list  http://koha-community.org
> >>> Koha at lists.katipo.co.nz
> >>> http://lists.katipo.co.nz/mailman/listinfo/koha
> >>>
> >>
> >>
> >>
> >> --
> >> Elaine Bradtke
> >> Data Wrangler
> >> VWML
> >> English Folk Dance and Song Society | http://www.efdss.org
> >> Cecil Sharp House, 2 Regent's Park Road, London NW1 7AY
> >> Tel    +44 (0) 20 7485 2206 (This number is for the English Folk Dance
> >> and Song Society in London, England. If you wish to phone me personally,
> >> send an e-mail first. I work off site)
> >>
> --------------------------------------------------------------------------
> >> Registered Company No. 297142
> >> Charity Registered in England and Wales No. 305999
> >>
> >>
> ---------------------------------------------------------------------------
> >> "Writing about music is like dancing about architecture"
> >> --Elvis Costello (Musician magazine No. 60 (October 1983), p. 52)
> >>
> >
> >
> >
> > --
> >
> >
> >
> >
>
>
> --
> Elaine Bradtke
> Data Wrangler
> VWML
> English Folk Dance and Song Society | http://www.efdss.org
> Cecil Sharp House, 2 Regent's Park Road, London NW1 7AY
> Tel    +44 (0) 20 7485 2206 (This number is for the English Folk Dance and
> Song Society in London, England. If you wish to phone me personally, send
> an e-mail first. I work off site)
> --------------------------------------------------------------------------
> Registered Company No. 297142
> Charity Registered in England and Wales No. 305999
> ---------------------------------------------------------------------------
> "Writing about music is like dancing about architecture"
> --Elvis Costello (Musician magazine No. 60 (October 1983), p. 52)
> _______________________________________________
> Koha mailing list  http://koha-community.org
> Koha at lists.katipo.co.nz
> http://lists.katipo.co.nz/mailman/listinfo/koha
>


More information about the Koha mailing list