I found this report here
https://www.lansweeper.com/report/average-time-until-initial-ticket-response-by-month/
I worked out that 864000 is seconds in a day, but then, I can't work out how to change that into hours and mins.
Any help please, would be greatly appreciated.
Select Top 1000000 DatePart(yyyy, htblticket.date) As Year,
DatePart(mm, htblticket.date) As Month,
Convert(Decimal(10,4),Avg(Cast(DateDiff(ss, htblticket.date,
InitialResponseDate.FirstPublicReply) As decimal) / 86400)) As AverageDays
From htblticket
Inner Join (Select Top 1000000 htblnotes.ticketid,
Min(htblnotes.date) As FirstPublicReply
From htblnotes
Inner Join htblagents On htblagents.userid = htblnotes.userid
Where htblnotes.notetype = 1
Group By htblnotes.ticketid) As InitialResponseDate On
InitialResponseDate.ticketid = htblticket.ticketid
Where htblticket.spam <> 'True'
Group By DatePart(yyyy, htblticket.date),
DatePart(mm, htblticket.date)
Order By Year Desc,
Month Desc
Thanks in advance
Tim