我有以下代码
SELECT dbo.COL_V_Cost_GEMS_Detail.TNG_SYS_NR AS [EHP Code],
dbo.COL_TBL_VCOURSE_NEW.TNG_NA AS [Course Title],
dbo.COL_TBL_VCOURSE_NEW.FCT_TYP_CD & dbo.COL_TBL_VCOURSE_NEW.DEP_TYP_CD AS [Course Owner],
dbo.COL_TBL_VCOURSE_TYP.TNG_DESC AS [TYPE OF TRAINING],
dbo.COL_V_Cost_GEMS_Detail.JOB_FCT_CD,
dbo.COL_V_Cost_GEMS_Detail.JOB_GRP_CD,
dbo.COL_V_Cost_GEMS_Detail.ST_COST_SUM + dbo.COL_V_Cost_GEMS_Detail.IN_COST_SUM AS [Total Cost],
SUM(dbo.COL_V_Cost_GEMS_Detail.STUDENTS) AS SumOfSTUDENTS,
SUM(dbo.COL_V_Cost_GEMS_Detail.INSTRUCTORS) AS SumOfINSTRUCTORS,
SUM(dbo.COL_V_Cost_GEMS_Detail.ST_HOURS_SUM) AS ST_HOURS,
SUM(dbo.COL_V_Cost_GEMS_Detail.ST_COST_SUM) AS ST_COST,
SUM(dbo.COL_V_Cost_GEMS_Detail.IN_HOURS_SUM) AS IN_HOURS,
SUM(dbo.COL_V_Cost_GEMS_Detail.IN_COST_SUM) AS IN_COST
FROM dbo.COL_V_Cost_GEMS_Detail INNER JOIN dbo.COL_TBL_VCOURSE_NEW
ON dbo.COL_V_Cost_GEMS_Detail.TNG_SYS_NR = dbo.COL_TBL_VCOURSE_NEW.TNG_SYS_NR
INNER JOIN dbo.COL_TBL_VCOURSE_TYP
ON dbo.COL_TBL_VCOURSE_NEW.TNG_MDA_TYP_CD = dbo.COL_TBL_VCOURSE_TYP.TNG_TYP
WHERE (dbo.COL_V_Cost_GEMS_Detail.RRDD NOT LIKE '%12%')
AND
(dbo.COL_V_Cost_GEMS_Detail.RRDD NOT LIKE '%13%')
AND
(dbo.COL_V_Cost_GEMS_Detail.RRDD NOT LIKE '%2706%')
AND
(dbo.COL_V_Cost_GEMS_Detail.RRDD NOT LIKE '%2707%')
AND
(dbo.COL_V_Cost_GEMS_Detail.RRDD NOT LIKE '%2331%')
GROUP BY dbo.COL_V_Cost_GEMS_Detail.TNG_SYS_NR,
dbo.COL_TBL_VCOURSE_NEW.TNG_NA,
dbo.COL_TBL_VCOURSE_NEW.FCT_TYP_CD & dbo.COL_TBL_VCOURSE_NEW.DEP_TYP_CD,
dbo.COL_TBL_VCOURSE_TYP.TNG_DESC,
dbo.COL_V_Cost_GEMS_Detail.JOB_FCT_CD,
dbo.COL_V_Cost_GEMS_Detail.JOB_GRP_CD,
dbo.COL_V_Cost_GEMS_Detail.ST_COST_SUM +
dbo.COL_V_Cost_GEMS_Detail.IN_COST_SUM
我不断收到错误
Msg 402, Level 16, State 1, Line 1
The data types nvarchar and nvarchar are incompatible in the boolean AND operator.
无论我做了什么改变,我似乎都无法摆脱这个错误。起初我以为是数据类型,但它们都很好,我以为是一些符号,但替换那些也不起作用。