‎08-09-2017 01:01 PM
Select Top 1000000 htblusers.name As AssignedAgent,
htblusers.username,
htblusers.userdomain,
Case htblagents.active When 1 Then 'Yes' Else 'No' End As IsLicensed,
Count(htblticket.ticketid) As TicketCount
From htblticket
Inner Join htblagents On htblagents.agentid = htblticket.agentid
Inner Join htblusers On htblusers.userid = htblagents.userid
Where DatePart(mm, htblticket.date) = DatePart(mm, GetDate()) And
DatePart(yyyy, htblticket.date) = DatePart(yyyy, GetDate()) And
htblticket.spam <> 'True'
Group By htblusers.name,
htblusers.username,
htblusers.userdomain,
htblagents.active
Order By AssignedAgent
Experience Lansweeper with your own data. Sign up now for a 14-day free trial.
Try Now