How and why to use the LIMIT function in an SQL report

How and why to use the LIMIT function in an SQL report







This document will outline how to use the LIMIT function in an SQL report to control the number of results a report returns. 

Why to use the LIMIT function?

The limit function reduces the number of results that a report will bring back to a specified number. This allows reports to be tested without risking taxing the resources on an active system. With the LIMIT function, reports can be edited and tested repeatedly to see the overall results 

How to add the LIMIT function to a report?

Either create a new report or edit an existing report.
Notes
For more details on how to access a report, please check our Help Centre

Go to the final line in the report.

Insert the line LIMIT 10, to reduce the number of results to 10. 
Running this report will bring back 10 results.


To change the number of results being brought back, update the LIMIT line to include a different number.

For example, if the report should bring back 50 results, the format should be LIMIT 50.



VersionDateDetailAuthor
1.008/05/26Doc. CreatedHolly Cooper














































    • Related Articles

    • Overview of some SQL Report Functions

      Overview of SQL Report Functions This FAQ is an example of a simple report describing the “anatomy” of the SQL code used.  Details about the different functions are outlined in the table below the report.  Some functions are mandatory to use in order ...
    • How to Find and Run a SQL Report

      What are reports for? Reports are used to find and present data about the information on the system in a structured manner. Reports use SQL to ask questions of the Koha database. How to find reports on your system Go to the Reports module on the Koha ...
    • How to view the content of an SQL report

      This document will outline how to view the content of an SQL report on the Koha system. This may be a precursor to editing the report or just a way to start studying the format of reports How to find reports on your system Go to the Reports module on ...
    • 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 ...
    • SQL Report Request Form

      How to submit an SQL report request The following are the steps of requesting a new SQL report to be created. 1. Log a ticket on the support portal to start the process. 2. Take a note of the ticket number. 3. Click the link below to be taken to an ...