早上好,
下面的代码返回的 calloffered 数量正好是我们的数据源为相关日期和工作组提供的电话号码的两倍。我在这里做错了什么?
USE CMT
GO
DECLARE @rd int
SET @rd='41426'
SELECT [date]
,skillGroup
,interval/48.000 interval
,sum(callsoffered)callsoffered
,sum(handleTime) /CAST(NULLIF(sum(acdcalls),0) as decimal(6,0))CRT
,(sum(acceptable) /cast(NULLIF(sum(callsoffered),0) as decimal(6,0))) SL
FROM vwForGrpISplit
WHERE [date] IN(@rd)
AND skillGroup IN ('AC English','AC Spanish','Consumer Credit','WLNP','CC Gen','CC
Spanish','Retention','Spanish Retention','Device Gen','RSL','FC Gen','FC Spanish','HBRM English','HBRM Spanish','Technical Care','STC','Tech Care Spanish','Prepaid English','Prepaid Spanish','Sub prime Tech')
GROUP BY [date], skillGroup, interval
ORDER BY skillGroup,[date], interval
代码运行没有错误,但返回查询的这部分引用的指标的错误值:
,sum(callsoffered)callsoffered
应该给出 27 的结果,但我得到的是 54。这部分公式提取的所有其他数据也是如此。
这两个公式都提取了正确的值:
,sum(handleTime) /CAST(NULLIF(sum(acdcalls),0) as decimal(6,0))CRT
,(sum(acceptable) /cast(NULLIF(sum(callsoffered),0) as decimal(6,0))) SL
我相信这很简单。有人可以帮我吗?
谢谢