日期:2014-05-18 浏览次数:20401 次
DECLARE @TB TABLE([Level] INT) INSERT INTO @TB SELECT 20 UNION ALL SELECT 21 UNION ALL SELECT 3 UNION ALL SELECT 5 UNION ALL SELECT 6 UNION ALL SELECT 10 UNION ALL SELECT 11 SELECT 级别,COUNT([Level]) LEVEL_COUNT FROM ( SELECT [Level],CASE WHEN ([Level]%10<>0) THEN ([Level]/10+1) ELSE ([Level]/10) END AS '级别' FROM @TB )X GROUP BY 级别 --------结果 级别 LEVEL_COUNT 1 4 2 2 3 1