0
我要計算的總時間的百分比爲每個ASSIGNEE_NAME百分比的總時間
select
ROUND(CAST(
(
select
CAST(AVG(DATEDIFF(SECOND, INF_TOWORK_TIME, INF_EXECUTE_TIME))as VARCHAR(10))
FROM [dbo].[PROBSUMMARYM1] IM
INNER JOIN [dbo].[MYGROUPSM1] MG on MG.ID = IM.ASSIGNEE_NAME
LEFT JOIN [dbo].[SCRELATIONM1] SC on IM.INCIDENT_ID = SC.SOURCE_ACTIVE
GROUP BY ASSIGNEE_NAME
)AS nvarchar),5)*100./
(
select
CAST(AVG(DATEDIFF(SECOND, INF_TOWORK_TIME, INF_EXECUTE_TIME))as VARCHAR(10))
FROM [dbo].[PROBSUMMARYM1] IM
INNER JOIN [dbo].[MYGROUPSM1] MG on MG.ID = IM.ASSIGNEE_NAME
LEFT JOIN [dbo].[SCRELATIONM1] SC on IM.INCIDENT_ID = SC.SOURCE_ACTIVE
)
FROM [dbo].[PROBSUMMARYM1] IM
INNER JOIN [dbo].[MYGROUPSM1] MG on MG.ID = IM.ASSIGNEE_NAME
LEFT JOIN [dbo].[SCRELATIONM1] SC on IM.INCIDENT_ID = SC.SOURCE_ACTIVE
GROUP BY ASSIGNEE_NAME
但我有一個錯誤:子查詢返回大於1倍的值這當子查詢跟隨是不允許的。 我在哪裏犯了一個錯誤? 謝謝