日期:2014-05-17 浏览次数:20561 次
select
[60-70]=sum(case when col>=60 and col<70 then 1 else 0 end),
[70-80]=sum(case when col>=70 and col<80 then 1 else 0 end),
[80-90]=sum(case when col>=80 and col<90 then 1 else 0 end)
from TB
select
[60-69]=sum(case when txt between 60 and 69 then 1 else 0 end),
[70-80]=sum(case when txt between 70 and 79 then 1 else 0 end),
[80-90]=sum(case when txt between 80 and 89 then 1 else 0 end)
from tb