怎样按时间段分组?
表结构
id(char) consume_time(datetime)
00000002 2003-08-26 11:46:00.000
00001047 2003-08-22 16:37:00.000
00001047 2003-08-26 16:34:00.000
00001074 2003-08-14 10:02:00.000
00001074 2003-08-14 10:03:00.000
比如下面的是按时间点分组
select id,consume_time,count(*)
from dbo.m_consume
group by id,consume_time
having count(*)>1
我现在要按每天一时间段(比如把2003-08-22日 7:00:00.000到 10:00:00.000 分为一组,而2003-08-23日 7:00:00.000到 10:00:00.000也分为一组 ),