我目前的任务是链接 LcsCDR SessionDetails 表中的数据。我正在使用 SSMS 来执行此操作。目前我必须为前一天发生的所有电话创建一个 Excel 报告,但没有链接这些数据。它还需要通话的持续时间。当一个电话进来时,它会通过总部然后被搁置,然后进入呼叫中心被接听,但是没有办法把它联系起来说它是一个。有人知道该怎么做吗?我可以在中心找到呼叫何时被接听,如下所示:
SELECT u2.UserId,
u1.UserUri,
u2.UserUri,
[CorrelationId],
rmd.Description, --Get the description
CONCAT((DATEDIFF(Hour,SessionIdTime,SessionEndTime)),':',
(DATEDIFF(Minute,SessionIdTime,SessionEndTime)), ':',
DATEDIFF(SECOND,SessionIdTime,SessionEndTime)) as TotalHours, -- Show the time in seconds
[SessionIdTime],
[SessionEndTime]
FROM SessionDetails sd
INNER JOIN Users AS u1 ON sd.User1Id = u1.UserId
INNER JOIN Users AS u2 ON sd.User2Id = u2.UserId
LEFT JOIN SIPResponseMetaData rmd ON sd.ResponseCode = rmd.ResponseCode
WHERE DATEDIFF(DAY, SessionIdTime, GETDATE()) = 1
AND rmd.Description <> 'Request Terminated'
AND CorrelationId IS NULL
AND DATEDIFF(SECOND, SessionIdTime, SessionEndTime) <> 0
ORDER BY SessionIdTime