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 book format?

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

I am using this code to get how many books that were loaned out by format. How do I get the sum of the Item_Count column? I see many examples using the SUM query but none that included pulling other data in . Can you help me please?
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 © 2024 · All Rights Reserved · PrimaSoft PC