Luis Yrigoyen | Erik, What are you trying to accomplish? all you want is the 4-digit team ID? or is this to build a report to show which team an agent belongs to?
if all you want is the 4-digit ID for a team then that table is the Agent_Team table in the AWDB but if you want to show which team an agent belongs to you would link two or three tables (three if you want to show the agent's full name)
A query like this one will give you the agent's full name and the name of the team:
select AgentName = (PERSON.FirstName + ' ' + PERSON.LastName), AGENT.EnterpriseName as AgentLoginName, --MEMBERSHIP.AgentTeamID, TEAMS.EnterpriseName as Team from t_Agent AGENT left join t_Person PERSON on AGENT.PersonID = PERSON.PersonID left join t_Agent_Team_Member MEMBERSHIP on AGENT.SkillTargetID = MEMBERSHIP.SkillTargetID left join t_Agent_Team TEAMS on MEMBERSHIP.AgentTeamID = TEAMS.AgentTeamID
order by TEAMS.EnterpriseName |
| Please sign in to flag this as inappropriate. |