oracle根据数值范围分组(groupby)create table aa_test
(
name varchar2(10),
num varchar2(10)
);
insert into aa_test values('admin1','1');
insert into aa_test values('admin1','2');
insert into aa_test values('admin1','11');
insert into aa_test values('admin1','12');
insert into aa_test values('admin1','22');
select a.*,a.rowid from aa_test a
-
-开始分组
select num ,count(1) from
(
select case
when num between 1 and 10 then '1到10分钟'
when num between 11 and 20 then '11到20分钟'
when num between 21 and 30 then '21到30分钟'
end num
from aa_testgroupby分组
)
group by num

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。