[Koha] Report for items held by 2 out of 3 branches

Cab Vinton bibliwho at gmail.com
Sat Feb 23 10:28:05 NZDT 2019


Hi, All --

Think the version below should do what we're looking for. (Thank you, Barton!)

All best,

Cab Vinton

SELECT
    b.biblionumber,
    SUBSTRING_INDEX(m.isbn, ' ', 1) AS isbn,
    b.title,
    i.homebranch,
    i.itemcallnumber
FROM
    items i
    LEFT JOIN biblioitems m USING (biblioitemnumber)
    LEFT JOIN biblio b ON i.biblionumber = b.biblionumber
WHERE
    i.itype = 'NEWBOOK'
    AND exists(
        select * from items where items.itemnumber = i.itemnumber AND
DATE_SUB(CURDATE(),INTERVAL 30 DAY) <= dateaccessioned
    )
GROUP BY
    b.biblionumber
HAVING
    isbn != ""
    AND count(i.homebranch) > 1
ORDER BY rand()
LIMIT 7


More information about the Koha mailing list