尝试运行代码时出现以下错误:“无法对包含聚合或子查询的表达式执行聚合函数。”
SELECT dbo.COL_TBL_WAGES.MANUAL, dbo.COL_TBL_VCOURSE.TNG_MDA_TYP_CD,
dbo.COL_2010_TRN_RESULTS2.TNG_SYS_NR,
COUNT(dbo.COL_2010_TRN_RESULTS2.EMP_TNG_STT_DT) AS CountOfEMP_TNG_STT_DT,
dbo.COL_MASTER_COURSE_LIST.Length,
COUNT(
COUNT(dbo.COL_2010_TRN_RESULTS2.EMP_TNG_STT_DT) * (
CASE WHEN IsNumeric([COL_TBL_VCOURSE].[LENGTH]) = 1
THEN [COL_TBL_VCOURSE].[LENGTH]
ELSE 0
END
)
) AS Total_Hours
FROM dbo.COL_TBL_WAGES INNER JOIN
dbo.COL_2010_TRN_RESULTS2 ON dbo.COL_TBL_WAGES.[Job Group Code] =
dbo.COL_2010_TRN_RESULTS2.JOB_GRP_CD INNER JOIN
dbo.COL_MASTER_COURSE_LIST ON dbo.COL_2010_TRN_RESULTS2.TNG_SYS_NR =
dbo.COL_MASTER_COURSE_LIST.[GEMS Code] INNER JOIN
dbo.COL_TBL_VCOURSE ON dbo.COL_2010_TRN_RESULTS2.TNG_SYS_NR =
dbo.COL_TBL_VCOURSE.TNG_SYS_NR
GROUP BY dbo.COL_MASTER_COURSE_LIST.Length, dbo.COL_TBL_WAGES.MANUAL,
dbo.COL_TBL_VCOURSE.TNG_MDA_TYP_CD,
dbo.COL_2010_TRN_RESULTS2.TNG_SYS_NR