Oracle 按日期统计 博客分类: ORCLE ORCLE
程序员文章站
2024-03-22 22:26:58
...
---------------按日期统计-----------------------------------------------------
--按照星期进行统计
SELECT TO_CHAR(SYSDATE, 'day') FROM DUAL GROUP BY TO_CHAR(SYSDATE, 'day');
--按照每周进行统计
SELECT TO_CHAR(SYSDATE, 'ww') FROM DUAL GROUP BY TO_CHAR(SYSDATE, 'ww');
--按照每月进行统计
SELECT TO_CHAR(SYSDATE, 'mm') FROM DUAL GROUP BY TO_CHAR(SYSDATE, 'mm');
--按照每季度进行统计
SELECT TO_CHAR(SYSDATE, 'q') FROM DUAL GROUP BY TO_CHAR(SYSDATE, 'q');
--按照每年进行统计
SELECT TO_CHAR(SYSDATE, 'yyyy')
FROM DUAL
GROUP BY TO_CHAR(SYSDATE, 'yyyy');