Query to list request IDs with Requester and Technician Employee ID (MSSQL)

Query to list request IDs with Requester and Technician Employee ID (MSSQL)


Tested in build MSSQL (14306)

Sample Table 


Database : MSSQL

Query

SELECT "wo"."WORKORDERID" AS "Request ID",
ti.FIRST_NAME AS "Technician",
td.employeeid "Tech Employee ID",
ti1.FIRST_NAME AS "Requester",
td1.employeeid "Req Employee ID"  FROM "WorkOrder" "wo"
LEFT JOIN "WorkOrderStates" "wos" ON "wo"."WORKORDERID"="wos"."WORKORDERID"
INNER JOIN "SDUser" "td" ON "wos"."OWNERID"="td"."USERID"
LEFT JOIN "AaaUser" "ti" ON "td"."USERID"="ti"."USER_ID"
LEFT JOIN "SDUser" "td1" ON "wo"."REQUESTERID"="td1"."USERID"
LEFT JOIN "AaaUser" "ti1" ON "td1"."USERID"="ti1"."USER_ID"
WHERE (wo.ISPARENT='1')

                  New to ADSelfService Plus?