select wo.workorderid "ID",au1.first_name "Requested By", wo.title "Title",longtodate(wo.createdtime) "Request Created Time", longtodate(wos.assignedtime)"Technician Assigned time",au.first_name"Technician Name",longtodate(woq.createdtime) "Group Assigned time",qd.queuename "Group Name",std.STATUSNAME "Request Status", cast(((wos.assignedtime-wo.createdtime)/1000 * interval '1 second') as varchar) "Response time", LONGTODATE(wo.resolvedtime) "Resolution Time" from workorder wo left join workorderstates wos ON wo.workorderid=wos.workorderid left join wo_assessment woa ON wo.workorderid=woa.workorderid left join wo_tech_info wti ON
woa.assessmentid=wti.assessmentid left join aaauser au ON wti.nexttechnicianid=au.user_id left join aaauser au1 on wo.requesterid=au1.user_id left join workorder_queue woq on wo.workorderid=woq.workorderid left join queuedefinition qd on woq.queueid=qd.queueid left join accountsitemapping asm on wo.siteid=asm.siteid left join accountdefinition ad on ad.org_id=asm.accountid LEFT JOIN StatusDefinition std ON wos.STATUSID=std.STATUSID where wti.technicianid is null and au.first_name is not null AND wo.CREATEDTIME >= <from_thismonth> AND wo.CREATEDTIME <= <to_thismonth> group by wo.workorderid,au.first_name,au1.first_name,wo.title,woq.createdtime,qd.queuename,wos.assignedtime,std.statusname
Assigned time taken more than 30 minutes:
select wo.workorderid "ID",au1.first_name "Requested By", wo.title "Title",longtodate(wo.createdtime) "Request Created Time", longtodate(wos.assignedtime)"Technician Assigned time", cast(((wos.assignedtime-wo.createdtime)/1000 * interval '1 second') as varchar) "Response time", au.first_name"Technician Name",longtodate(woq.createdtime) "Group Assigned time",qd.queuename "Group Name",std.STATUSNAME "Request Status", LONGTODATE(wo.resolvedtime) "Resolution Time" from workorder wo left join workorderstates wos ON wo.workorderid=wos.workorderid left join wo_assessment woa ON wo.workorderid=woa.workorderid left join wo_tech_info wti ON
woa.assessmentid=wti.assessmentid left join aaauser au ON wti.nexttechnicianid=au.user_id left join aaauser au1 on wo.requesterid=au1.user_id left join workorder_queue woq on wo.workorderid=woq.workorderid left join queuedefinition qd on woq.queueid=qd.queueid left join accountsitemapping asm on wo.siteid=asm.siteid left join accountdefinition ad on ad.org_id=asm.accountid LEFT JOIN StatusDefinition std ON wos.STATUSID=std.STATUSID where wti.technicianid is null and au.first_name is not null AND (((wos.assignedtime)-(wo.createdtime))/1000/60) > 30 AND wo.CREATEDTIME >= <from_thismonth> AND wo.CREATEDTIME <= <to_thismonth> group by wo.workorderid,au.first_name,au1.first_name,wo.title,woq.createdtime,qd.queuename,wos.assignedtime,std.statusname