Query to get Request Closure Comments added by requester.

Query to get Request Closure Comments added by requester.

Version : 13000
DB : MSSQL / PGSQL



SELECT wo.WORKORDERID AS "Request ID",
wo.TITLE AS "Subject",
cd.CATEGORYNAME AS "Category",
scd.NAME AS "Subcategory",
rtdef.NAME AS "Request Type",
lvd.LEVELNAME AS "Level",
std.STATUSNAME AS "Request Status",
wo.CREATEDTIME AS "Created Time",
wo.RESOLVEDTIME AS "Resolved Time",
wotodesc.FULLDESCRIPTION AS "Description",
pd.PRIORITYNAME AS "Priority",
aau.FIRST_NAME AS "Requester",
ti.FIRST_NAME AS "Technician",
wo_st.comments "Closure Comment" 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
LEFT JOIN PriorityDefinition pd ON wos.PRIORITYID=pd.PRIORITYID
LEFT JOIN LevelDefinition lvd ON wos.LEVELID=lvd.LEVELID
LEFT JOIN SubCategoryDefinition scd ON wos.SUBCATEGORYID=scd.SUBCATEGORYID
LEFT JOIN RequestTypeDefinition rtdef ON wos.REQUESTTYPEID=rtdef.REQUESTTYPEID
LEFT JOIN WorkOrderToDescription wotodesc ON wo.WORKORDERID=wotodesc.WORKORDERID
LEFT JOIN wo_assessment wo_ass ON wo.WORKORDERID=wo_ass.WORKORDERID
LEFT JOIN wo_status_info wo_st ON wo_ass.assessmentid = wo_st.assessmentid
LEFT JOIN StatusDefinition sisd ON wo_st.STATUSID = sisd.STATUSID
LEFT JOIN StatusDefinition sinsd ON wo_st.NEXTSTATUSID = sinsd.STATUSID where sinsd.statusname = 'Closed'

                New to ADSelfService Plus?