select distinct(d.dt), sum(d.num) from
(
select dt, count(*) as num,i.row_id,i.created_date from testtable i,
(select to_date('2011/12/4 18:54:30','yyyy/mm/dd HH24:mi:ss') + (level-1)/86400*5 dt from dual connect by level <= 2000) d
where i.created_date>=dt and i.created_date < d.dt+(5/86400)
group by d.dt,i.row_id,i.created_date
order by dt
) d group by d.dt
一个ORACLE间隔时间的查询语句
最新推荐文章于 2023-09-20 09:13:00 发布
本文介绍了一段使用SQL实现的功能,通过日期分组并计算每个分组内的记录数量。具体操作涉及子查询、日期运算及GROUP BY语句的应用。

7897

被折叠的 条评论
为什么被折叠?



