我想从多个表中生成一个大表,LEFT OUTER JOIN
但在我得到结果之前服务器似乎超时了。难道我做错了什么?
SELECT
mtl_extended_info.TM,
mtl_extended_info.EMP_ID,
mtl_extended_info.DNAME,
mtl_extended_info.STATUS,
mtl_extended_info.SHIFT,
mtl_extended_info.SKILL,
IFNULL(cdl_metrics_all.Sched_Adh, '-') as Sched_Adh,
IFNULL(cdl_metrics_all.Sched_Compl, '-') as Sched_Compl,
IFNULL(SUM(enterprise_rep_agent_stats.Calls_Handled_Ct), '-') as Call_Handled,
IFNULL(ROUND((SUM(enterprise_rep_agent_stats.I_Talk_Time_Sec) + SUM(enterprise_rep_agent_stats.Hold_Time_Sec) + SUM(enterprise_rep_agent_stats.I_Work_Time_Sec) + SUM(enterprise_rep_agent_stats.I_AUX_Out_Time_Sec)) / SUM(enterprise_rep_agent_stats.Calls_Handled_Ct)), '-') as AHT,
IFNULL(cdl_metrics_all.AHT_Target, '-') as AHT_Target,
IFNULL(ROUND(SUM(enterprise_rep_agent_stats.I_Talk_Time_Sec) / SUM(enterprise_rep_agent_stats.Calls_Handled_Ct)), '-') as TALK,
IFNULL(ROUND(SUM(enterprise_rep_agent_stats.I_Work_Time_Sec) / SUM(enterprise_rep_agent_stats.Calls_Handled_Ct)), '-') as ACW,
IFNULL(ROUND(SUM(enterprise_rep_agent_stats.Hold_Time_Sec) / SUM(enterprise_rep_agent_stats.Calls_Handled_Ct)), '-') as Hold,
IFNULL(SUM(cdl_rr7_all.Score), '-') as R7,
IFNULL(cdl_deact_all.Deact_Rate_Excl_Port, '-') AS DeactWOPort,
IFNULL(cdl_deact_all.Deact_Rate_Incl_Port, '-') AS DeactPort,
IFNULL(cdl_deact_all.Deac_Target, '-') as Deact_Target,
IFNULL(TRUNCATE((SUM(cdl_cmp_oe_all.CMP_OE_Virtual) / SUM(cdl_cmp_oe_all.CMP_Surveys)), 2), '-') AS CMP_OE,
IFNULL(SUM(cdl_cmp_oe_all.CMP_Surveys), '-') AS CMP_Surveys,
IFNULL(cdl_metrics_all.ICV_WR, '-') as ICV_WR,
IFNULL(cdl_metrics_all.ICV_WR_Target, '-') as ICV_WR_Target,
IFNULL(cdl_metrics_all.ICV_CA, '-') as ICV_CA,
IFNULL(cdl_metrics_all.ICV_CA_Target, '-') as ICV_CA_Target
FROM mtl_extended_info
LEFT OUTER JOIN enterprise_rep_agent_stats ON enterprise_rep_agent_stats.Employee_ID = mtl_extended_info.EMP_ID
LEFT OUTER JOIN cdl_metrics_all ON cdl_metrics_all.EMP_ID = mtl_extended_info.EMP_ID
LEFT OUTER JOIN cdl_rr7_all ON cdl_rr7_all.EMP_ID = mtl_extended_info.EMP_ID
LEFT OUTER JOIN cdl_deact_all ON cdl_deact_all.EMP_ID = mtl_extended_info.EMP_ID
LEFT OUTER JOIN cdl_cmp_oe_all ON cdl_cmp_oe_all.EMP_ID = mtl_extended_info.EMP_ID
WHERE VISIBLE = 1
GROUP BY mtl_extended_info.EMP_ID, enterprise_rep_agent_stats.Month_Date
ORDER BY SM, TM
预期结果(这只是我期望的 300 行中的一行):
TM | EMP_ID | DNAME | STATUS | mtl_extended_info.SHIFT | mtl_extended_info.SKILL | Sched_Adh | Sched_Compl | Call_Handled | AHT | AHT_Target | TALK | ACW | Hold | R7 | DeactWOPort | DeactPort | Deact_Target | CMP_OE | CMP_Surveys | ICV_WR | ICV_WR_Target | ICV_CA | ICV_CA_Target
Peter Pan | 841255 | John Doe | Active | Full Time | Cable Repair | 90% | 95% | 641 | 954 | 800 | 641 | 83 | 56 | 86% | 73% | 74% | Deact_Target | 100% | 14 | 86 | 1.4 | -14.87 | -12.4
我收到以下错误:错误代码:1317。查询执行被中断