Handy Library Manager
 for Windows


Help, how to topics > Custom Views > How to create a report "how many books were loaned out by book format".?


How many books were loaned out by format?

Ready to use Handy Library Manager SQL queries: How many books were loaned out by format?

I am using this SQL query to determine how many books were loaned out by format. However, I need help calculating the sum of the Item_Count column. I have seen many examples using the SUM function, but none include pulling in additional data. Can you please assist me?

SELECT A.Category, COUNT(*) AS ITEM_COUNT FROM LOAN B JOIN LIBRARY A ON B.ITEM_IDNO = A.IDNO WHERE B.LOANDATE < CURRENT_DATE AND B.LOANDATE >= CURRENT_DATE-30 GROUP BY Category;


SELECT A.CATEGORY, COUNT(*) AS ITEM_COUNT FROM LOAN B JOIN LIBRARY A ON B.ITEM_IDNO=A.IDNO WHERE B.LOANDATE < CURRENT_DATE AND B.LOANDATE>=CURRENT_DATE-30 GROUP BY CATEGORY UNION ALL SELECT 'SUM' ITEM_IDNO, COUNT(*) FROM LOAN WHERE LOANDATE < CURRENT_DATE AND LOANDATE>=CURRENT_DATE-30;

Tables and fields used in the query:

A - Libary Items table (LIBRARY)
B - Loans table (LOAN)


Questions:



Copyright © 2025 · All Rights Reserved · PrimaSoft PC