求统计每周记录数的SQL语句
创始人
2025-01-31 13:03:52
求统计每周记录数的SQL语句
select date_col,
to_number(to_char(trunc(sysdate, 'yyyy'), 'd')) year_week_day,
first_day_week,
week_no,
week_no - first_day_week + 1 week_no
from (select date_col,
to_number(to_char(trunc(sysdate, 'mm') + 7 - 1, 'ww')) first_day_week,
to_number(to_char(date_col + 7 - 1, 'ww')) week_no
from (select trunc(sysdate, 'mm') + rownum - 1 date_col
from dba_objects
where rownum <= to_number(to_char(last_day(sysdate), 'dd'))))

执行后,参考。
是指那一周一共有多少条记录的话
表应该有id吧
select count(id) from 表名 between 起始日期 and 最终日期
是这个意思么....

相关内容

热门资讯

废弃瓶盖“再生”花朵,AI赋能... 一堵公共墙面,在废弃物的妆点下,成了一道靓丽的艺术风景线。最近,一面位于杨浦区定海路街道的墙面“火了...
重庆发改委主任高健:重庆加快培... 编者按: 当前,如何将中央经济工作会议精神切实转化为地方实践,成为重要议题。三里河工作室专访地方省(...
英伟达发布Nemotron 3... 来源:环球网 【环球网科技综合报道】12月16日消息,据VentureBeat报道,英伟达近日正式...