SELECT to_char("日期字段",'YYYY-MM-dd') time ,count(*) FROM "表名" GROUP BY time;
SELECT to_char("日期字段",'YYYY-MM') time ,count(*) FROM "表名" GROUP BY time;
SELECT to_char("日期字段",'YYYY') time ,count(*) FROM "表名" GROUP BY time;
SELECT to_char("日期字段",'day') time ,count(*) FROM "表名" GROUP BY time;
SELECT to_char("日期字段",'Q') time ,count(*),to_char("日期字段",'YYYY') ctime FROM "表名" GROUP BY time,ctime;
- 统计每月第几天产生多少数据(和日期统计差不多,3个DDD统计当前年的第多少天)
SELECT to_char("日期字段",'DD') time ,count(*),to_char("日期字段",'YYYY-MM-dd') ctime FROM "表名" GROUP BY time,ctime;
SELECT to_char("日期字段",'YYYY/MM/DD:PM:DY') time ,count(*) FROM "表名" GROUP BY time;
SELECT TO_CHAR("日期字段", 'YYYY/MM/DD') AS NOW,TO_CHAR("日期字段" - INTERVAL '7'day ,'YYYY/MM/DD') AS PAST,count(*) FROM "表名" GROUP BY NOW,PAST;
SELECT TO_CHAR("日期字段", 'YYYY/MM/DD HH24:MI:SS') AS NOW,TO_CHAR("日期字段"- INTERVAL '7' second,'YYYY/MM/DD HH24:MI:SS') AS PAST FROM "表名"
SELECT TO_CHAR("日期字段", 'YYYY/MM/DD HH24:MI:SS') AS NOW,TO_CHAR("日期字段"- INTERVAL '7' minute,'YYYY/MM/DD HH24:MI:SS') AS PAST FROM "表名"
SELECT TO_CHAR("日期字段", 'YYYY/MM/DD HH24:MI:SS') AS NOW,TO_CHAR("日期字段"- INTERVAL '7'hour ,'YYYY/MM/DD HH24:MI:SS') AS PAST FROM "表名"
SELECT TO_CHAR("日期字段", 'YYYY/MM/DD HH24:MI:SS') AS NOW,TO_CHAR("日期字段"- INTERVAL '7'day ,'YYYY/MM/DD HH24:MI:SS') AS PAST FROM "表名"
SELECT TO_CHAR("日期字段", 'YYYY/MM/DD HH24:MI:SS') AS NOW,TO_CHAR("日期字段" - INTERVAL '7'month ,'YYYY/MM/DD HH24:MI:SS') AS PAST FROM "表名"
SELECT TO_CHAR("日期字段", 'YYYY/MM/DD HH24:MI:SS') AS NOW,TO_CHAR("日期字段"- INTERVAL '7'year ,'YYYY/MM/DD HH24:MI:SS') AS PAST FROM "表名"
SELECT TO_CHAR("日期字段", 'YYYY/MM/DD HH24:MI:SS') AS NOW,TO_CHAR("日期字段"- 8*INTERVAL '7'hour ,'YYYY/MM/DD HH24:MI:SS') AS PAST FROM "表名"