我正在尝试做什么:
修改sql查询以提供更具体的数据。
简要数据摘要:我正在拨打有关呼叫中心代表的报告。这显示了呼叫数据,如呼叫持续时间,入站/出站,未接来电等。想法是获取过去30天的报告,显示CSR每天的每次呼叫。例如,如果分机7200每天接听5个电话,那么在过去30天内,报告应该只为该代表显示150个电话。
然而,它目前正在做的是每天每个代表只拨一个电话。因此,对于15个代表,我每个日期只获得15行,所以我的报告目前只有大约345行。
以下是查询:
Insert into test.AMBrawDataDump(
Extension,
Start_Time,
End_Time,
Duration,
Inbound_Answered,
Missed,
Outbound,
Hold_Time,
Call_term_reason)
SELECT
c.extension -- USER EXTENSION
, b.STARTTIME -- Start of call
, b.ENDTIME -- End of call
, b.DURATION -- Length of call
, CASE WHEN a.LEGTYPE1 = 2 AND ANSWERED = 1
THEN 1 ELSE 0 END AS Inbound_Answered -- Inbound answered
calls
, CASE WHEN ANSWERED = 0
THEN 1 ELSE 0 END AS Missed -- Missed Calls
, CASE WHEN a.LEGTYPE1 = 1
THEN 1 ELSE 0 END AS Outbound -- Outbound calls
, a.HOLDTIMESECS -- Hold time in seconds
, a. TERMINATIONREASONCODE
FROM cdrdb.session a
INNER JOIN cdrdb.callsummary b
ON a.NOTABLECALLID = b.NOTABLECALLID
INNER join cdrdb.mxuser c
ON a.RESPONSIBLEUSEREXTENSIONID = c.EXTENSIONID
WHERE b.ts BETWEEN curdate() - interval 30 day and curdate()
AND c.extension IN (7276,7314,7295,7306,7357,7200,7218,7247,7331,7255,7330,7000,7215,7240,7358,7312)
group by DATE(b.ts),c.extension;
因此,所提取的数据是正确的(这是通过按日期(b.ts)和c.extension分组完成的),但是,它每天每个代表只拨一个电话,而不是每天每个电话的所有电话。
我应该在这里做一件明显的事情来获取这些数据吗?