[Koha] Empty shelves
Paul A
paul.a at navalmarinearchive.com
Thu Apr 17 03:40:49 NZST 2014
Help requested, please -- the MySQL part of my brain is obviously not at
the right caffeine level.
Over the years, we have used a lot of "shelves" (authorized values, mostly
temporary boxes) and now I need to identify the "empty" ones as a
cleanup/caretaking excercise.
The following SQL query works syntactically, and finds any shelf with at
least one item:
SELECT authorised_values.authorised_value AS Auth_Location,
COUNT(DISTINCT biblioitems.biblionumber) as Quantity
FROM biblioitems
LEFT JOIN items ON (items.biblioitemnumber=biblioitems.biblioitemnumber)
LEFT JOIN authorised_values ON
(authorised_values.authorised_value=items.location)
WHERE authorised_values.category LIKE 'loc'
GROUP BY authorised_values.authorised_value HAVING COUNT(DISTINCT
biblioitems.biblionumber)>0;
but if I change the final >0 to =0 it fails to find any empty box ;={
I'm sort-of convinced that this comes from JOINing the
authorised_values.authorised_value to the items.location (obviously that
location no longer exists in items), but am going in circles looking for an
alternate method.
Thanks in advance -- Paul
More information about the Koha
mailing list