sqlserver中如何实现时间按月,日,小时分组查询

--按照月份统计 select count(id) cnt,datepart(mm,time) [Month] from [table] where [time] between '2007/09/08 09:10:43' and '2007/10/09 04:32:37' group by datepart(mm,time) --按照日统计 select count(id) cnt,datepart(dd,time) [Day] from [table] where time between '2007/09/08 09:10:43' and '2007/10/09 04:32:37' group by datepart(dd,time) --按照小时统计 select count(id) cnt,datepart(hh,time) [Hour] from [table] where [time] between '2007/09/08 09:10:43' and '2007/10/09 04:32:37' group by datepart(hh,time)

相关文章

本篇内容主要讲解“sqlalchemy的常用数据类型怎么使用”,感...
今天小编给大家分享一下sqlServer实现分页查询的方式有哪些的...
这篇文章主要介绍“sqlmap之osshell怎么使用”,在日常操作中...
本篇内容介绍了“SQL注入的知识点有哪些”的有关知识,在实际...
1. mssql权限sa权限:数据库操作,文件管理,命令执行,注册...
sql执行计划如何查看?在SPL庞大的数据中我们不知道如何查看...