Postgres Query to show parent and child requests.

select conv.workorderid “Parent Request ID”, longtodate(wo.createdtime) “Created time”,longtodate(wo.completedtime) “Completed time”,array_to_string(array_agg(conv.child_woid), ‘, ‘) as “Child Request ID’s”,cd.categoryname “Category”, “Subcategory”,dd.deptname “Department”, “Site”,qd.QUEUENAME “Support Group”,aaau.first_name “Assigned Technician”,cast((wo.TIMESPENTONREQ/1000 * interval ‘1 second’) as varchar) AS “Time Elapsed” from conversation conv
LEFT JOIN workorder wo on conv.workorderid=wo.workorderid
LEFT JOIN workorderstates wos ON wos.workorderid=wo.workorderid
LEFT JOIN categorydefinition cd ON wos.categoryid=cd.categoryid
LEFT JOIN subcategorydefinition scd ON wos.subcategoryid=scd.subcategoryid
LEFT JOIN departmentdefinition dd ON wo.deptid=dd.deptid
LEFT JOIN sitedefinition sdef ON wo.siteid=sdef.siteid
LEFT JOIN sdorganization sdd ON wo.siteid=sdd.org_id
left join aaauser aaau ON wos.ownerid=aaau.user_id
LEFT JOIN QueueDefinition qd ON woq.QUEUEID=qd.QUEUEID
where conv.child_woid is not null group by conv.workorderid,cd.categoryname,,dd.deptname,,qd.queuename,aaau.first_name,wo.TIMESPENTONREQ,wo.createdtime,wo.completedtime,wo.TIMESPENTONREQ




This entry was posted in Reports.

Need More Help?

Are you looking for a personalized customer support? Submit your question or Call our Toll Free Number to speak with ServiceDesk Plus MSP Expert who can offer a better solution for your requirements.

Submit a Ticket
Email :
Toll Free : 1-888-720-9500