请问如何对时间进行分组

[复制链接]
查看11 | 回复2 | 2014-10-28 06:00:13 | 显示全部楼层 |阅读模式
--测试数据
create table test_date(col_date date);
insert into test_datevalues(to_date('2021-11-16 22:35:00','yyyy-mm-dd hh24:mi:ss'));
insert into test_datevalues(to_date('2021-11-16 23:35:00','yyyy-mm-dd hh24:mi:ss'));
insert into test_datevalues(to_date('2021-11-16 24:35:00','yyyy-mm-dd hh24:mi:ss'));
insert into test_datevalues(to_date('2021-11-16 20:35:00','yyyy-mm-dd hh24:mi:ss'));
insert into test_datevalues(to_date('2021-11-16 18:35:00','yyyy-mm-dd hh24:mi:ss'));
insert into test_datevalues(to_date('2021-11-16 07:35:00','yyyy-mm-dd hh24:mi:ss'));
insert into test_datevalues(to_date('2021-11-16 08:35:00','yyyy-mm-dd hh24:mi:ss'));
insert into test_datevalues(to_date('2021-11-16 14:35:00','yyyy-mm-dd hh24:mi:ss'));
insert into test_datevalues(to_date('2021-11-16 12:35:00','yyyy-mm-dd hh24:mi:ss'));
commit;
求助一下,请问当天8:00 到第二天早上8:00如果按2小时进行分组,如何统计呢?

回复

使用道具 举报

千问 | 2014-10-28 06:00:13 | 显示全部楼层
trunc interval
回复

使用道具 举报

千问 | 2014-10-28 06:00:13 | 显示全部楼层
http://www.itpub.net/thread-1348543-1-1.html
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行