22,209
社区成员
发帖
与我相关
我的任务
分享
select case when count(*)=0 then 0 else score end from (select top 1 score from ZX_RESULT_INDEXSYSTEM
where companyCode = '20161017'
and indexCode = '201609261811'
and datepart(month,inspectDate)=10
and datepart(year,inspectDate)=2016
order by inspectDate desc) t
SELECT ISNULL(MAX(score), 0)
FROM ( SELECT TOP 1
score
FROM ZX_RESULT_INDEXSYSTEM
WHERE companyCode = '20161017'
AND indexCode = '201609261811'
AND DATEPART(MONTH, inspectDate) = 10
AND DATEPART(YEAR, inspectDate) = 2016
ORDER BY inspectDate DESC
) t;