我在 ISNULL() 函数中放错了一些东西,需要另一双眼睛才能找到它。我盯着它看得太多了,我已经变得脑残了(我知道 ISNULL() 是什么,这只是一个简单的语法错误)
(SELECT tn.teamtext, tn.teamid, ISNULL(sum(ISNULL(case when CONVERT(smalldatetime,dModLast,101) BETWEEN '2012-03-01' AND '2012-03-10' then 1 else 0 end), 0), 0) AS cnt3
FROM teamnames AS tn
LEFT OUTER JOIN caseaudit AS ca
ON tn.teamID = ca.referteamID2
WHERE ca.referteamid1 <> ca.referteamid2 AND isactive = 1 AND groupid = 18 AND accountid = 2 AND referteamid1 = 31 AND auditnote <> 'Suspend Case'
GROUP BY tn.teamtext, tn.teamid) AS c