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

统计这样的年份!!!!!!!!!!!!!!!!!!!!!!!!
timed   (smalldatetime)
2005-11-08
2005-11-10
2005-12-11
2006-11-08
2006-11-10
2006-12-11
2007-11-08
2007-11-10
2008-12-11

怎么查询出来如下结果?
2005
2006
2007
2008




------解决方案--------------------
select year(timed),count(*) from 表 group by year(timed)
------解决方案--------------------

select year(timed) as timed from tbName
group by year(timed)
------解决方案--------------------
select distinct year(timed) from 表 order by timed