[Koha] Reports returning different totals

Cindy Weber cweber at scls.lib.wi.us
Fri May 6 02:59:54 NZST 2011


We recently went live and I'm now trying to run the monthly statistics 
reports I've set up.  One of the reports is to total the number of 
checkouts and renewals for the month listed by library and the other is 
the same total number of checkouts and renewals but listed by the 
borrower category code.  These two reports should equal but don't.  When 
I was trying to figure out what is going wrong, I found the following 
two reports don't give the same results but as near as I can tell, they 
should.  Can anyone please, please tell me why I'm seeing different 
results and which numbers are correct?  We're on PTFS Koha.

Thanks!

Report 1 totals for the first three libraries:
LIB1    4497
LIB2    10130
LIB3    1710

SQL for Report 1:
SELECT borrowers.branchcode AS 'Library', COUNT(statistics.itemnumber) 
AS 'Total CKO'
FROM statistics
JOIN borrowers ON (borrowers.borrowernumber = statistics.borrowernumber)
WHERE (statistics.datetime) >= '2011-04-15' AND 
DATE(statistics.datetime) <= '2011-04-30'
AND statistics.type IN ('issue','renew')
GROUP BY borrowers.branchcode


Report 2 totals for the first three libraries:
LIB1    4161
LIB2    9746
LIB3    1647

SQL for Report 2:
SELECT statistics.branch AS Library, COUNT(statistics.itemnumber) AS 
'Total CKO'
FROM statistics
WHERE DATE(statistics.datetime) >= '2011-04-15' AND 
DATE(statistics.datetime) <= '2011-04-30'
AND statistics.type IN ('issue','renew')
GROUP BY statistics.branch

-- 
Cindy Weber                       cweber at scls.lib.wi.us
System Support Specialist         (608)242-4710
South Central Library System    



More information about the Koha mailing list