select count(case when (assessmarks=3 and AssessDate>DateAdd("m", -2, getdate())) then assessmarks end ) as towMonth,
count(case when (assessmarks=3 and AssessDate>DateAdd("m", -6, getdate())) then assessmarks end ) as halfYear,
count(case when (assessmarks=3 and AssessDate>DateAdd("m", -12, getdate())) then assessmarks end ) as oneYear,
count(case when (assessmarks=3 and AssessDate< getdate()) then assessmarks end ) as AllAssess,
3 as marks
from ProductAssessInfo where userid=345
sql统计(多个统计结果)
最新推荐文章于 2024-07-24 22:55:47 发布