[Koha-devel] Branch column in statistics table

Cab Vinton bibliwho at gmail.com
Thu May 3 17:42:31 CEST 2018


Hi, All --

According to the schema, the branch column represents the branch
"where the transaction occurred".

How does Koha treat transfers in the statistics table?

My assumption has been that data in statistics.branch represents where
an item was ultimately issued to a patron (i.e., rather than the the
initial transfer from the holding library).

Is this correct?

I ask because I ran a couple of reports, one based on the
branchtransfers table and one based on the statistics table, that
provided unexpected results.

Specifically, I would have expected the number of transfers to be much
higher than the number of issues at non-home branches.

The reports, however, seem to indicate 1,650 transfers to a particular
branch versus 2,450 issues where those patrons actually traveled to
other branches (statistics.branch).

Grateful for any insight the list can provide. (Including the reports below.)

All best,

Cab Vinton, Director
Plaistow Public Library
Plaistow, NH


SELECT b.categorycode, s.branch as 'checked out at', b.branchcode as
'patron branch', count(s.datetime) as count
FROM statistics s
LEFT JOIN borrowers b ON (s.borrowernumber = b.borrowernumber)
WHERE s.type in ('issue')
AND s.datetime BETWEEN '2017-05-01' AND '2018-04-30'
GROUP BY b.categorycode, s.branch, b.branchcode

SELECT t.frombranch, t.tobranch, COUNT(*)
FROM branchtransfers t
WHERE t.datesent BETWEEN '2017-05-01' AND '2018-04-30'
GROUP BY t.frombranch, t.tobranch


More information about the Koha-devel mailing list