The SELECT clause works with the WHERE clause to define what information you want your report to include.
It often contains column references which specify the data you want to retrieve from the table you choose in the FROM clause.
See the Appendix for a full list of columns.
For example, suppose you want to produce a table like this of all the tickets that meet a certain condition, e.g. awaiting agent:
Your SELECT clause would be a comma-separated list of column references:
SELECT tickets.id, tickets.subject, tickets.person, tickets.department, tickets.date_created, tickets.agent copy
The SELECT clause can also use DPQL List Of Functions
For example, suppose you didn’t want a detailed table of all matching tickets, just the total number. You would use the DPQL_COUNT() function to count the total number of matching tickets.
SELECT DPQL_COUNT() copy
In table output, the header text for a column is automatically derived from the SELECT used to produce the column. This may not always result in a good column name; for example, if you just used SELECT COUNT()
, you’ll produce a table like this:
You can use an alias to specify a better name for a column.
DPQL_COUNT() AS 'Total Tickets' copy
Would make the result display like this:
If you want to retrieve all the columns from a table, you can use a wildcard such as SELECT people.
Mewngofnodwch neu cofrestrwch i gyflwyno sylw.