oracle 按照时间间隔进行分组

1 select sum(SHOW_NUMBER) as SHOW_NUMBER ,d.dt
2 from T_RECOMMEND_ANALYSIS t,(
3 select to_date('2018-06-08','yyyy-MM-dd') - (level-1) * 7 dt  
4 from dual connect by level <=15) d
5 where t.CREATE_TIME<dt and t.CREATE_TIME> d.dt-7
6 group by d.dt 

按照时间7天进行分组

 

posted @ 2018-06-08 17:09  随风而逝,只是飘零  阅读(773)  评论(0编辑  收藏  举报