Query Guide
5.Order by
GROUP BY If you want to group by 5th column then the order by should be in the same line. SELECT wo.WORKORDERID AS "Request ID", wo.TITLE AS "Subject", cd.CATEGORYNAME AS "Category", std.STATUSNAME AS "Request Status", ti.FIRST_NAME AS "Technician" ...
2. Select Statement
The SELECT statement is used to query the database and retrieve the fields that you specify. You can select as many fields as you want. Adding columns to the query: Refer to the below KB article for the Database schema. ...
1. Query Basics
Basic Query: SELECT wo.WORKORDERID AS "Request ID", wo.TITLE AS "Subject", aau.FIRST_NAME AS "Requester", ti.FIRST_NAME AS "Technician", cd.CATEGORYNAME AS "Category", std.STATUSNAME AS "Request Status" FROM WorkOrder wo LEFT JOIN SDUser sdu ON ...
3. Conditions
We can use WHERE condition to filter the records. SELECT wo.WORKORDERID "Request ID", std.STATUSNAME "Request Status" FROM WorkOrder wo LEFT JOIN WorkOrderStates wos ON wo.WORKORDERID=wos.WORKORDERID LEFT JOIN StatusDefinition std ON ...
4. Date Filter
Custom Date Filter Format: PGSQL createdtime >= CAST(EXTRACT(EPOCH FROM TIMESTAMP '2019-01-01 00:00:00') * 1000 AS BIGINT) AND createdtime <= CAST(EXTRACT(EPOCH FROM TIMESTAMP '2019-01-30 00:00:00') * 1000 AS BIGINT) SELECT wo.WORKORDERID AS ...
6. Database Schema
Request Module Column Name Column Value Joining Table Request ID wo.workorderid workorder wo Request Subject wo.title workorder wo Request created time longtodate(wo.createdtime) workorder wo Request category cd.CATEGORYNAME LEFT JOIN ...