cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
700
Views
10
Helpful
3
Replies

Total Number of Active Agents in an Agent Team

abhilash2001
Level 1
Level 1

We have several configured Agents in several Agent Teams. I am looking to run a query on total agents in each agent teams who have recently logged in so we can eliminate some of the old configured agents. Any ideas? 

1 Accepted Solution

Accepted Solutions

piyush aghera
Spotlight
Spotlight

Here we go, look for LastLoginTime to find agents who have logged in recently.

 

SELECT DISTINCT P.FirstName, P.LastName, P.LoginName, MAX(AED.LoginDateTime) AS LastLoginTime, Agent_Team_Member.AgentTeamID, Agent_Team.EnterpriseName
FROM Agent A, Agent_Event_Detail AED, Person P, Agent_Team_Member, Agent_Team
WHERE A.SkillTargetID = AED.SkillTargetID
and Agent_Team_Member.AgentTeamID = Agent_Team.AgentTeamID
and A.SkillTargetID = Agent_Team_Member.SkillTargetID
AND A.PersonID = P.PersonID
GROUP BY P.FirstName, P.LastName, P.LoginName, Agent_Team_Member.AgentTeamID, Agent_Team.EnterpriseName
ORDER BY LastLoginTime desc

 

 

View solution in original post

3 Replies 3

piyush aghera
Spotlight
Spotlight

Here we go, look for LastLoginTime to find agents who have logged in recently.

 

SELECT DISTINCT P.FirstName, P.LastName, P.LoginName, MAX(AED.LoginDateTime) AS LastLoginTime, Agent_Team_Member.AgentTeamID, Agent_Team.EnterpriseName
FROM Agent A, Agent_Event_Detail AED, Person P, Agent_Team_Member, Agent_Team
WHERE A.SkillTargetID = AED.SkillTargetID
and Agent_Team_Member.AgentTeamID = Agent_Team.AgentTeamID
and A.SkillTargetID = Agent_Team_Member.SkillTargetID
AND A.PersonID = P.PersonID
GROUP BY P.FirstName, P.LastName, P.LoginName, Agent_Team_Member.AgentTeamID, Agent_Team.EnterpriseName
ORDER BY LastLoginTime desc

 

 

Thank you very much Piyush, you are the best. Appreciate all your help.

You're welcome :-)