08-09-2017 11:49 AM
Select Top 1000000 htblusers.name As Agent,
htblusers.username,
htblusers.userdomain,
Case htblagents.active When 1 Then 'Yes' Else 'No' End As IsLicensed,
Avg(htblnotes.timeworked) As AvgMinutesPerNote
From htblnotes
Inner Join htblusers On htblusers.userid = htblnotes.userid
Inner Join htblagents On htblusers.userid = htblagents.userid
Inner Join htblticket On htblticket.ticketid = htblnotes.ticketid
Where DatePart(mm, htblnotes.date) = DatePart(mm, GetDate()) And
DatePart(yyyy, htblnotes.date) = DatePart(yyyy, GetDate()) And
htblnotes.timeworked Is Not Null And htblticket.spam <> 'True'
Group By htblusers.name,
htblusers.username,
htblusers.userdomain,
htblagents.active
Order By Agent
Experience Lansweeper with your own data. Sign up now for a 14-day free trial.
Try Now