ORACLE按周统计数据

oracle数据库默认的每周开始日期是周一,日常分析中往往需要统计周一至周日的数据,引用next_day函数方便的解决了该问题。

next_day(trunc(f_Logtime)-7,'星期一')

-- 例子

select next_day(trunc(f_Logtime)-7,'星期一') f_Logtime,

       count(distinct f_luid) week_newuser

  from t_ol_frxzard_register_user

 group by next_day(trunc(f_Logtime)-7,'星期一')

猜你喜欢

转载自lizhiyu.iteye.com/blog/2184959