Koha How-To

Writing Reports is as easy as ordering a cup of coffee!

Writing reports in Koha can be intimidating. How do you know what tables you want to use, what's the proper syntax, what does SQL stand for anyway?

This blog post won't answer all your questions, but when we're done, writing a new report shouldn't be any more intimidating than ordering an iced venti salted caramel mocha frappuccino with toffee nut syrup, double blended with extra whipped cream!

Fundamentally, when you write a SQL report you are asking koha a question in a language the software understands. The basic parts of the question are Selecting the data you want and telling Koha where to go get the data From. The Where clause is used to curate that information down to only the date range, call number range, or zip code range you want.

Let's continue with food based analogies. If the Reports module had a cookbook it would be the SQL Reports Library. The SQL statements in this wiki have been written by Koha users world-wide. You can copy the statements (or recipes) wholesale or use them as a starting point to craft a new report.

Koha has robust Database Schemas for each version of Koha from 3.18 to 18.11! These schemas tell you where everything lives in the database. Bibliographic information is stored in tables that start with "biblio". Patron information is stored in tables that start with "borrower". You can think of it as an index for your cookbook.

With a few ingredients (or data points) on hand what recipes (or reports) can you make?

If you're ready for your next shot of sql-sspresso follow this link to our wealth of reports tutorials: https://bywatersolutions.com/education/tag/reports-tutorial