1. Query Basics

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 wo.REQUESTERID=sdu.USERID
LEFT JOIN AaaUser aau ON sdu.USERID=aau.USER_ID
LEFT JOIN WorkOrderStates wos ON wo.WORKORDERID=wos.WORKORDERID
LEFT JOIN CategoryDefinition cd ON wos.CATEGORYID=cd.CATEGORYID
LEFT JOIN SDUser td ON wos.OWNERID=td.USERID
LEFT JOIN AaaUser ti ON td.USERID=ti.USER_ID
LEFT JOIN StatusDefinition std ON wos.STATUSID=std.STATUSID
WHERE (wo.ISPARENT='1')
  AND wo.CREATEDTIME >= <from_thismonth>
  AND wo.CREATEDTIME <= <to_thismonth>

Select Statement:

The SELECT statement is used to query the database and retrieve the fields that you specify. You can select as many fields (column names) as you want, or use the asterisk symbol "*" to select all fields. 

For adding columns in the query use the below link.


Conditions:

The WHERE clause specifies which data values or rows will be returned or displayed, based on the criteria you specify. 

For adding conditions in the query use the below link.


For adding date filter in the query use the below link.


Order by:

The ORDER BY clause organizes/sorts the data by the field specified. 

For organizes/sorts the data by the field specified in the query use the below link.







                    New to ADSelfService Plus?

                      • Related Articles

                      • Advanced Analytics - FAQ & Troubleshooting tips

                        Troubleshooting tips This document is listing of customer facing issues,  Advanced analytics is common name for both Zoho reports and Analytics plus.  First setup we have to get with customer that recreate issue and generate support log ...
                      • How to resolve Connectivity issues with Postgresql Database from our product?

                        Log Traces Feb 20, 2024 6:40:00 PM [SYSERR] [INFO] : java.sql.SQLException: java.lang.Exception: Exception during getConnection from pool Exception occurred during get connection from datasource Nov 15, 2023 1:29:10 PM [SYSERR] [INFO] : Caused by: ...
                      • Remote read only access to database for Postgres customers

                        Use case: Frequently customers want to connect some reporting / dashboard application like PowerBI or Tableau with our Postgres database server. By default, the bundled Postgres is configured to only listen to the local machine. We can configure to ...
                      • How to Connect to SDP MSP Database ?

                        1. In-Built POSTGRES (PGSQL) : Open a CMD prompt as an administrator and navigate to ManageEngine\ServiceDeskPlus-MSP\pgsql\bin and run the below command From SDP MSP build 10538 , please use the below method. psql -h localhost -U sdpadmin -p 65432 ...
                      • Query to display additional field associations with templates (MSSQL)

                        Tested in build MSSQL (14306) Use case The reports shows in which templates the created additional fields are associated Query select sd.name "Service Catalog Name", rt.templatename "Template name", fc.field_name "Fields" from requesttemplate_list rt ...