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,'星期一')
原文章浏览量:1287
原文章分类:数据库
原文链接:https://www.iteye.com/blog/lizhiyu-2184959