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 ...
                    • Query Executor Tool for PostGres

                      This tool is designed to execute queries in the customer environment by connecting the database by reading the database configuration file. We need to enter the query that we require to execute in queryToExecute.txt file. We can enter multiple ...
                    • Query Executor Tool for Postgres

                      Overview: A query executor tool for PostgreSQL that allows for query execution without a direct database connection enhances security and flexibility while collaborating on query testing without the need for each team member to have direct database ...
                    • 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 ...