sqlserver中如何实现时间按月,日,小时等时间分组查询
2017-08-10 11:25
721 查看
--按照月份统计
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'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