日期:2014-05-19  浏览次数:20596 次

急急!这个sql怎么写啊!
我要达到这样的效果,表中有个 "维修年月 "的字段,现在我想通过查询得到这样的数据
年度范围                                                            
1955年以前--1955
1956--1960  
1961--1965
1966--1970
1971--1975
1976--1980
1981--1985
1986--1990
1991--1995
1996--2000
2001--2005
2006--2010


------解决方案--------------------
用 case ... when ... end 处理。
------解决方案--------------------
select case when year(维修年月) between 2006 and 2010 then '2006--2010 '
case when year(维修年月) between 2001 and 2005 then 2001--2005 '
.
.
else '1955年以前--1955 '
end