sqlserver中如何实现时间按月,日,小时分组查询
2011-10-19 11:32
507 查看
--按照月份统计
select count(id) cnt,datepart(mm,time) [Month]
fromwhere [time] between '2007/09/08 09:10:43' and '2007/10/09 04:32:37'where time between '2007/09/08 09:10:43' and '2007/10/09 04:32:37'
select count(id) cnt,datepart(mm,time) [Month]
from