Boa Tarde a todos
Um cliente demandou uma query para visualizar Agentes, Supervisores, Times, PQs e Filas
O resultado é multidimensional, mas colocado num EXCEL numa planilha Pivot permite ver bem a estrutura configurada.
A Query:
/*
Listagem agentes supervisores com seus respectivos fila e time
by zhiago@hotmail.COM
2023/04/27
*/
SELECT
PQ.[EnterpriseName] AS PQent
,PQ.[Description] AS PQ
,AT.[Description] AS Atributo
,AG.[EnterpriseName] AS AgenteL
,AG.[Description] AS Agente
,AT.[Description] AS Time
,AG1.[EnterpriseName] AS SupervisorL
,AG1.[Description] AS Supervisor
FROM [ccpro_awdb].[dbo].[Precision_Queue_Term] PQT
INNER JOIN [ccpro_awdb].[dbo].[Precision_Queue] PQ ON PQT.PrecisionQueueID = PQ.PrecisionQueueID
INNER JOIN [ccpro_awdb].[dbo].[Attribute] ATB ON PQT.[AttributeID] = ATB.AttributeID
INNER JOIN [ccpro_awdb].[dbo].[Agent_Attribute] AA ON ATB.AttributeID = AA.AttributeID
INNER JOIN [ccpro_awdb].[dbo].[Agent] AG ON AA.SkillTargetID = AG.SkillTargetID
INNER JOIN [ccpro_awdb].[dbo].[Agent_Team_Member] ATM ON AG.SkillTargetID = ATM.SkillTargetID
INNER JOIN [ccpro_awdb].[dbo].[Agent_Team] AT ON AT.AgentTeamID = ATM.AgentTeamID
INNER JOIN [ccpro_awdb].[dbo].[Agent_Team_Supervisor] ATS ON AT.AgentTeamID = ATS.AgentTeamID
INNER JOIN [ccpro_awdb].[dbo].[Agent] AG1 ON ATS.SupervisorSkillTargetID = AG1.SkillTargetID
ORDER BY PQent, Agente
Enviem sugestões e perguntas
Zhiago@hotmail.com