[Koha] Report help- reading history
kbrowne at ccpcs.org
Tue Sep 23 08:25:48 NZST 2014
This is SUPER rough and cobbled-together, but it's the best I could do in a
few minutes. If I have time later, I'll try to clean it up a bit (or others
are welcome to do so). I have NOT tested it very extensively!
It doesn't show multiple checkouts of the same item by the same patron, but
otherwise it should do basically what you're asking.
SELECT topten.name, biblio.title, biblio.author
LEFT JOIN items ON (items.itemnumber = statistics.itemnumber)
LEFT JOIN biblio ON (items.biblionumber = biblio.biblionumber)
LEFT JOIN (SELECT CONCAT(p.surname, ", ", p.firstname) AS name,
FROM statistics s
LEFT JOIN borrowers p ON (s.borrowernumber=p.borrowernumber)
WHERE DATE(s.datetime) BETWEEN <<Top checkouts BETWEEN (yyyy-mm-dd)|date>>
AND <<and (yyyy-mm-dd)|date>>
AND s.itemnumber IS NOT NULL
GROUP BY p.borrowernumber
ORDER BY COUNT(s.borrowernumber) DESC
LIMIT 10) topten ON (topten.borrowernumber = statistics.borrowernumber)
WHERE topten.name IS NOT NULL AND statistics.datetime BETWEEN <<Enter same
start date (yyyy-mm-dd)|date>> AND <<and same end date (yyyy-mm-dd)|date>>
AND statistics.type = "issue"
ORDER BY topten.name ASC
Middle/High School Librarian
Capital City Public Charter School
100 Peabody Street NW
Washington, DC 20011
(202) 387-0309 x1745
kbrowne at ccpcs.org
On Mon, Sep 22, 2014 at 3:58 PM, clint.deckard <
clint.deckard at frontiers.co.nz> wrote:
> Dear Vishal Patil,
> thank you for the assistance.
> The school did use the 'Patrons checking out the most' report and then
> copied and paste the reading history into a spreadsheet to produce the
> information they needed, it's just that they were hoping for a solution
> that required a little less intervention.
> I should have provided more information in my initial request for help. My
> I appreciate you taking the time to help.
> Best wishes,
> vishal patil wrote:
>> Visit koha report library for any sql report:
>> On Mon, Sep 22, 2014 at 12:38 PM, clint.deckard <
>> clint.deckard at frontiers.co.nz <mailto:clint.deckard at frontiers.co.nz>>
>> A school I deal with would like a report that lists the reading
>> history of the top 10 borrowers so that they can award a prize to
>> each. As I am not a sql expert I would appreciate some assistance.
>> Much appreciated,
>> Clint Deckard
>> Central Hawkes Bay, New Zealand.
>> Koha mailing list http://koha-community.org
>> Koha at lists.katipo.co.nz <mailto:Koha at lists.katipo.co.nz>
>> *Warm Regards,
>> Vishal Patil
>> *Software Engineer - Nucsoft Ltd.
>> phone: 022 32080161 | mob: 08767505528
>> www.osslabs.biz <http://www.osslabs.biz/>
>> www.nucsoft.com <http://www.nucsoft.com/>
>> vishal.patil at osslabs.biz <mailto:vishal.patil at osslabs.biz>
> Koha mailing list http://koha-community.org
> Koha at lists.katipo.co.nz
More information about the Koha