Query to get Request details with SLA and Group change info

Query to get Request details with SLA and Group change info

Version : 10524
DB : MSSQL

Output:





SELECT wo.WORKORDERID "Request ID",
wo.TITLE "Subject",
reqtl.TEMPLATENAME "Template Name",
std.STATUSNAME AS "Request Status",
serdef.NAME AS "Service Category",
sladefinition.slaname "SLA NAME",
convert(varchar(5),((wo.TIMESPENTONREQ))/1000/3600)+':'+convert(varchar(5),(((wo.TIMESPENTONREQ))/1000)%3600/60)+':'+convert(varchar(5),
((((wo.TIMESPENTONREQ)))/1000%60))  "total time elapsed",
qd.QUEUENAME "Group",
qd1.QUEUENAME  "From Group",
qd2.QUEUENAME  "To Group",
cast((wog.timespent/60) as varchar(20)) +':'+cast((wog.timespent % 60) as varchar(20)) "groupTime Spent" FROM WorkOrder wo
LEFT JOIN RequestTemplate_list reqtl ON wo.TEMPLATEID=reqtl.TEMPLATEID
LEFT join sladefinition on wo.slaid=sladefinition.slaid
LEFT JOIN WorkOrderStates wos ON wo.WORKORDERID=wos.WORKORDERID LEFT JOIN ItemDefinition icd ON wos.ITEMID=icd.ITEMID LEFT JOIN SubCategoryDefinition scd ON wos.SUBCATEGORYID=scd.SUBCATEGORYID 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 WorkOrder_Queue woq ON wo.WORKORDERID=woq.WORKORDERID LEFT JOIN QueueDefinition qd ON woq.QUEUEID=qd.QUEUEID
left join wo_assessment woa on wo.workorderid=woa.workorderid
inner join WO_GROUP_INFO wog on woa.assessmentid=wog.assessmentid
LEFT JOIN QueueDefinition qd1 ON wog.groupid=qd1.QUEUEID
LEFT JOIN QueueDefinition qd2 ON wog.nextgroupid=qd2.QUEUEID
LEFT JOIN ServiceDefinition serdef ON wo.SERVICEID=serdef.SERVICEID
LEFT JOIN StatusDefinition std ON wos.STATUSID=std.STATUSID
 WHERE (wo.ISPARENT='1') order by 1

                New to ADSelfService Plus?