How to add an alias to a field in an SQL report

How to add an alias to a field in an SQL report







This document will outline how to define a custom label for a field in an SQL report. Fields in SQL report results will default to the name of the field in the Koha database. However, it is possible to add a custom label that is of more use to the report user.

Notes
For details on how to view the content of an existing report, please check our Help Centre or contact Interleaf Technology directly.

Default label in the report results

When you run the report without alias created, the results will appear in a table with the default field names in the database at the top row of the table. 



Notes
For more details on how to find and run a report on your system, contact Interleaf Technology directly or check our Help Centre

Adding a custom label in the report results

Identify the field to add an alias for.



To add a label to the result field insert the command AS



Type in the preferred label for the field in quotes. 

Running this report will show results using the defined alias instead of the standard label from the table in the database.



General information

If the label is one word or phrase without a space, the label can be added without quotes. 

If the label has multiple words with spaces, the label must be added with quotes.

It is not required to add alias for every field, just the field(s) to add a new name to. 


Version

DateDetailsAuthor
1.012/05/26Document createdHolly Cooper
1.114/05/26Adding detailsHolly 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 ...
    • Question of the Week - Using the CASE statement and formatting information to be included in a SQL report

      This document will outline how a list of information can be formatted so it can be easily added to a SQL statement as well as a creative way we used the CASE statement to categorise the different system preferences being shown in an SQL report. The ...
    • 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 ...
    • 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 ...
    • 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 ...