0
SELECT
COUNT(CALL_KEY) AS CONTACTS,
SUM(CASE WHEN answer_time IS NOT NULL AND A.ent_split IS NOT NULL AND call_type NOT LIKE 'PBX%' THEN 1 ELSE 0 END) AS CH,
CAST((CAST(SUM(A.talk_time)
/(CASE WHEN COUNT(A.answer_time) = 0 THEN 1 ELSE COUNT(A.answer_time) END) AS float) + CAST(SUM(A.hold_time) AS float)
/(CASE WHEN COUNT(A.answer_time) = 0 THEN 1 ELSE COUNT(A.answer_time) END)) + CAST(SUM(A.work_time) AS float)
/CAST(COUNT(CASE WHEN A.answer_time > 0 THEN 1 ELSE 1 END) AS numeric(8, 2)) AS Int) AS AHT,
SUM(CASE WHEN abandon_time IS NOT NULL AND answer_time IS NULL THEN 1 ELSE 0 END) AS Total_ABN,
SUM(A.answer_speed) AS ASA,
SUM(CASE WHEN answer_time IS NOT NULL AND A.ent_split IS NOT NULL AND call_type NOT LIKE 'PBX%' THEN 1 ELSE 0 END) + SUM(CASE WHEN abandon_time IS NOT NULL AND answer_time IS NULL THEN 1 ELSE 0 END) AS CO
FROM reporting_call_matrix AS A WITH (NOLOCK)
WHERE A.CALENDAR_DATE >= '5/31/2016' AND A.CALENDAR_DATE <= '7/19/2016' AND A.SPLIT IN (43) AND (A.ent_split IS NOT NULL)
這裏是我的結果如何打破我的成績下降到月
CONTACTS CH AHT Total_ABN ASA CO
17199 16744 640 448 580643 17192
評論在此之前後獲得。 .. [如何從日期字段使用SQL按月分組](http://stackoverflow.com/questions/14565788/how-to-group-by-mon-month-from-date-field-using-sql) – JohnH