For library administration, accreditation audits, and collection development, an item-by-item list is often too granular. A Title-Wise Administrative Report groups holdings by bibliographic record while summarizing copy counts, live availability, and total collection value.
Below is a production-ready, institution-agnostic SQL report you can paste directly into Koha → Reports → Create from SQL.
Title-Wise Administrative Report SQL
SELECT
b.biblionumber AS Biblio_ID,
IFNULL(NULLIF(TRIM(BOTH ' /:;.,' FROM REGEXP_REPLACE(
CONCAT_WS(' : ',
NULLIF(TRIM(BOTH ' /:;.,' FROM b.title), ''),
NULLIF(TRIM(BOTH ' /:;.,' FROM ExtractValue(bm.metadata, '//datafield[@tag="245"]/subfield[@code="b"]')), '')
),
'[[:space:]]+', ' '
)), ''), '-') AS Title,
IFNULL(NULLIF(TRIM(BOTH ' /:;.,' FROM REGEXP_REPLACE(b.author, '[[:space:]]+', ' ')), ''), '-') AS Author,
IFNULL(NULLIF(TRIM(BOTH ' /:;.,' FROM ExtractValue(bm.metadata, '//datafield[@tag="250"]/subfield[@code="a"]')), ''), '-') AS Edition,
IFNULL(NULLIF(TRIM(BOTH ' /:;.,' FROM bi.publishercode), ''), '-') AS Publisher,
IFNULL(NULLIF(TRIM(BOTH ' /:;.,[]()' FROM IFNULL(NULLIF(CAST(b.copyrightdate AS CHAR), '0'), ExtractValue(bm.metadata, '//datafield[@tag="260"]/subfield[@code="c"]'))), ''), '-') AS Pub_Year,
IFNULL(NULLIF(TRIM(BOTH ' -' FROM bi.isbn), ''), '-') AS ISBN,
IFNULL(NULLIF(TRIM(BOTH ' /:;.,' FROM REGEXP_REPLACE(ExtractValue(bm.metadata, '//datafield[@tag="650"]/subfield[@code="a"]'), '[[:space:]]+', ' ')), ''), '-') AS Subject,
IFNULL(NULLIF(TRIM(BOTH ' /:;.,' FROM ExtractValue(bm.metadata, '//datafield[@tag="526"]/subfield[@code="a"]')), ''), '-') AS Department,
IFNULL(NULLIF(TRIM(it.description), ''), '-') AS Item_Type,
IFNULL(NULLIF(TRIM(BOTH ' /:;.,' FROM MIN(i.itemcallnumber)), ''), '-') AS Call_Number,
COUNT(i.itemnumber) AS Total_Copies,
SUM(CASE WHEN i.withdrawn = 0 AND i.itemlost = 0 AND i.damaged = 0 AND i.notforloan = 0 AND iss.issue_id IS NULL THEN 1 ELSE 0 END) AS Available_Copies,
SUM(CASE WHEN iss.issue_id IS NOT NULL THEN 1 ELSE 0 END) AS Checked_Out_Copies,
SUM(CASE WHEN i.damaged != 0 OR i.itemlost != 0 OR i.withdrawn != 0 THEN 1 ELSE 0 END) AS Unavailable_Copies,
ROUND(SUM(IFNULL(i.price, 0)), 2) AS Total_Value,
IFNULL(DATE_FORMAT(MIN(i.dateaccessioned), '%d %b %Y'), '-') AS First_Accessioned
FROM biblio b
INNER JOIN items i ON i.biblionumber = b.biblionumber
LEFT JOIN biblioitems bi ON bi.biblioitemnumber = i.biblioitemnumber
LEFT JOIN biblio_metadata bm ON bm.biblionumber = b.biblionumber
LEFT JOIN itemtypes it ON it.itemtype = IFNULL(i.itype, bi.itemtype)
LEFT JOIN issues iss ON iss.itemnumber = i.itemnumber
WHERE (i.itype = <<Select Item Type|itemtypes>> OR (i.itype IS NULL AND bi.itemtype = <<Select Item Type|itemtypes>>))
AND ExtractValue(bm.metadata, '//datafield[@tag="526"]/subfield[@code="a"]') LIKE CONCAT('%', <<Department (or % for all)>>, '%')
GROUP BY b.biblionumber
ORDER BY b.title ASC
Key Administrative Fields Included
- Bibliographic Identity: Biblio ID, Full Title (
245$a+245$b), Author, Edition (250$a), Publisher, Publication Year, and ISBN. - Classification & Academic Mapping: Subject (
650$a), Department / Program (526$a), Item Type, and Call Number. - Holdings & Circulation Summary: Total Copies, Available Copies, Checked Out Copies, and Unavailable Copies (Damaged / Lost / Withdrawn).
- Financial & Audit Metrics: Total Value (sum of item prices) and First Accession Date.
How to Run This Report in Koha
- Log in to the Koha Staff Interface with a user account that has Reports permissions.
- Go to Reports → Guided reports → Create from SQL (or Reports → Create from SQL).
- Enter a Report name (e.g., Title-Wise Administrative Collection Report) and optionally select a Report group (e.g., Catalog or Inventory).
- Paste the SQL query above into the SQL box and click Save report.
- Click Run report:
- Select Item Type: Choose the collection type from the dropdown (e.g., Books, Reference, Journals).
- Department (or % for all): Type a department/program name (e.g.,
CSE,BBA) to filter, or enter%to include all departments.
- Click Run the report. You can then view the results in the browser or click Download to export as CSV / Excel for administrative meetings and audits.
Comments
Post a Comment