The two most common SQL statements within Koha application reports

The two most common SQL statements within Koha application reports


This document will outline the two most common statements which appear in SQL reports run in the Koha application. SQL reports within the Koha application can only be run the return information that exists in the database, however, other SQL tools may allow the editing and updating of the underlying database. Editing and updating the underlying database is not possible from within the Koha reports tool. 

The two statements required to structure an SQL report in Koha

SELECT 
FROM

These two statements that will appear in almost every SQL report created on Koha. After the SELECT statement, there will be a list of the fields the report should display. After the FROM statement, there will be a list of the tables the information should be taken from.

SELECT 

One of two mandatory statements that enable a report to work. This function defines the columns you want to draw information from. It should appear at the start of every report.

FROM 

One of two mandatory functions to enable the report to work. FROM is the function that determines what the primary table the information requested with the SELECT function will be drawn from. 

Example of how these statements are used in a report


SELECT borrowers.cardnumber, borrowers.firstname, borrowers.surname
FROM borrowers
Notes
For more details on reports, please contact Interleaf Technology directly. To request a report, please check our Help Centre.

VersionDateDetailAuthor
1.028/04/26Document createdHolly Cooper
1.229/04/26Details addedHolly Cooper