日期:2014-05-18 浏览次数:20609 次
SELECT sum(case when id is not null or LEN(id)) = 0 then 0 else 1 end) as num FROM V_TG_Client_Success WHERE AgentID = 1 AND CONVERT(VARCHAR(4), RegDate, 120) = CONVERT(VARCHAR(4), GETDATE(), 120) AND MONTH(RegDate) IN (1,2,3,4,5,6,7,8,9,10,11,12)
------解决方案--------------------
SELECT sum(case when id is not null or LEN(id)) = 0 then 0 else 1 end) as num FROM V_TG_Client_Success WHERE AgentID = 1 AND CONVERT(VARCHAR(4), RegDate, 120) = CONVERT(VARCHAR(4), GETDATE(), 120) AND MONTH(RegDate) IN ('1','2','3','4','5','6','7','8','9','10','11','12')