日期:2014-05-18  浏览次数:20336 次

这样的分类语句能简化吗
如题
select   case   月度  
when   1   then   '第一季度 '  
when   2   then   '第一季度 '
when   3   then   '第一季度 '
when   4   then   '第二季度 '
...
when   12   then   '第四季度 '

end
as   季度
    from   Table  

我想简化成类似:

select   case   月度  
when   1,2,3   then   '第一季度 '  
when   4,5,6   then   '第2季度 '
when   7,8,9   then   '第3季度 '
when   10,11,12,13   then   '第4季度 '

end
as   季度
    from   Table

------解决方案--------------------
select case
when 月度 in(1,2,3) then '第一季度 '
when 月度 in(4,5,6) then '第2季度 '
when 月度 in(7,8,9) then '第3季度 '
else '第4季度 '
end
as 季度
from Table1