[Koha] SQL report help
Heather Braum (NEKLS)
hbraum at nekls.org
Thu Mar 10 18:02:34 NZDT 2016
Kerrie,
Are you just wanting count of items per collection code at a set branch?
And no other information displayed? If so, try
SELECT items.ccode, count(items.itemnumber)
FROM items
WHERE items.homebranch=<<Home branch|branches>>
GROUP BY items.ccode
That should get you what you are you looking for, if I'm understanding what
you're after correctly. Here's a quick breakdown of above report, if you're
interested:
SELECT line = the data columns you're going to display in the report.
(ccode, counting something)
FROM = the table where the data is going to come from (items)
WHERE = your criteria (limiting to a branch parameter)
GROUP BY = How your data is grouped (in this case by collection code)
Hope that helps.
Heather Braum
NExpress Coordinator
Resource Sharing Librarian
Northeast Kansas Library System
hbraum at nekls.org
"The illiterate of the 21st century will not be those who cannot read
and write, but those who cannot learn, unlearn, and relearn." ~Alvin
Toffler, *Rethinking the Future*
On Wed, Mar 9, 2016 at 11:46 PM, Kerrie Stevens <KStevens at harvest.edu.au>
wrote:
> I'm trying to get a report to show the number of items in each collection
> code according to the branch selected. I've looked in the reports library
> but can't find anything that is exactly right. I've tried to mix'n'match
> bits from a few reports but I keep getting an error message about syntax.
>
> This is what I have so far:
> SELECT
> items.ccode,items.itemcallnumber,items.itype,biblio.author,biblio.title,
> biblio.copyrightdate
> COUNT( i.barcode ) AS "Count"
> FROM items
> LEFT JOIN biblio ON (biblioitems.biblionumber=biblio.biblionumber)
> WHERE items.homebranch=<<Home branch|branches>>
> ORDER BY items.dateaccessioned DESC
>
> Any help, much appreciated.
> Thank you
>
> Kerrie
> Harvest Bible College
> _______________________________________________
> Koha mailing list http://koha-community.org
> Koha at lists.katipo.co.nz
> https://lists.katipo.co.nz/mailman/listinfo/koha
>
More information about the Koha
mailing list