Average response time - by date range

Average response time - by date range

Hello,

I'm trying to run a query to return the average response time of all tickets by technician for a sate range, in my case i need the last two years but will need to adjust this later on.

I found this query below that returns the correct information for last month but I'm having trouble converting this to return data for a specific date range i.e. 2014-05-01 to 2016-05-01

We are using ServiceDesk Plus - MSP version 8.3 Build 8311 with MSSQL back end.

Hoping someone can assist.


select  aau.first_name "Technician" ,count(wo.workorderid)  "total tickets" ,  avg((wo.respondedtime-wo.createdtime)/60000) "Avg Time taken to respond"   from workorder wo  left join workorderstates wos on wo.workorderid = wos.workorderid  left join helpdeskcrew hc on hc.technicianid=wos.ownerid left join aaauser aau on hc.technicianid=aau.user_id   LEFT JOIN WorkOrder_Queue woq ON wo.WORKORDERID=woq.WORKORDERID LEFT JOIN QueueDefinition qd ON woq.QUEUEID=qd.QUEUEID    where  wo.createdtime >= <from_lastmonth> and wo.createdtime <= <to_lastmonth>  and wo.respondedtime!=0 
group by  aau.first_name

                New to ADSelfService Plus?