分时间段查询销售总量

insert into testdd(ids,names,resid,dates) values(2,'qw','123456',   to_date('2017/2/7 00:10:00', 'yyyy-mm-dd hh24:mi:ss'));
insert into testdd(ids,names,resid,dates) values(3,'qw','123456',   to_date('2017/2/7 01:10:00', 'yyyy-mm-dd hh24:mi:ss'));
insert into testdd(ids,names,resid,dates) values(4,'qw','123456',   to_date('2017/2/7 01:20:00', 'yyyy-mm-dd hh24:mi:ss'));
insert into testdd(ids,names,resid,dates) values(5,'qw','123456',   to_date('2017/2/7 02:00:00', 'yyyy-mm-dd hh24:mi:ss'));
insert into testdd(ids,names,resid,dates) values(6,'qw','123456',   to_date('2017/2/7 03:00:00', 'yyyy-mm-dd hh24:mi:ss'));
insert into testdd(ids,names,resid,dates) values(7,'qw','123456',   to_date('2017/2/7 04:00:00', 'yyyy-mm-dd hh24:mi:ss'));
insert into testdd(ids,names,resid,dates) values(8,'qw','123456',   to_date('2017/2/7 05:00:00', 'yyyy-mm-dd hh24:mi:ss'));
insert into testdd(ids,names,resid,dates) values(9,'qw','123456',   to_date('2017/2/7 06:00:00', 'yyyy-mm-dd hh24:mi:ss'));
insert into testdd(ids,names,resid,dates) values(10,'qw','123456',   to_date('2017/2/7 07:00:00', 'yyyy-mm-dd hh24:mi:ss'));
insert into testdd(ids,names,resid,dates) values(11,'qw','123456',   to_date('2017/2/7 08:00:00', 'yyyy-mm-dd hh24:mi:ss'));
insert into testdd(ids,names,resid,dates) values(12,'qw','123456',   to_date('2017/2/7 09:00:00', 'yyyy-mm-dd hh24:mi:ss'));
insert into testdd(ids,names,resid,dates) values(13,'qw1','1123456',   to_date('2017/2/7 10:00:00', 'yyyy-mm-dd hh24:mi:ss'));
insert into testdd(ids,names,resid,dates) values(14,'qw','123456',   to_date('2017/2/7 11:00:00', 'yyyy-mm-dd hh24:mi:ss'));
insert into testdd(ids,names,resid,dates) values(15,'qw','123456',   to_date('2017/2/7 12:00:00', 'yyyy-mm-dd hh24:mi:ss'));
insert into testdd(ids,names,resid,dates) values(16,'qw','123456',   to_date('2017/2/7 13:00:00', 'yyyy-mm-dd hh24:mi:ss'));
insert into testdd(ids,names,resid,dates) values(17,'qw','123456',   to_date('2017/2/7 14:00:00', 'yyyy-mm-dd hh24:mi:ss'));
insert into testdd(ids,names,resid,dates) values(18,'qw','123456',   to_date('2017/2/7 15:00:00', 'yyyy-mm-dd hh24:mi:ss'));




select count(d.ids),d.time_line from
(select ids,to_char(dates,'hh24') time_line from testdd )d
 group by d.time_line  order by d.time_line;
 
--sum(sal) over (partition by deptno  order by ename)






select * from testdd
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值