Oracle 统计时/分钟/秒的数据量

2020-06-15  本文已影响0人  salt丶

相关代码-查询小时:

SELECT SUBSTR(TO_CHAR(A.CREATE_TIME, 'YYYY-MM-DD HH24:MI:SS'), 0, 13), COUNT(1)

  FROM TABLE A

WHERE A.CREATE_TIME >= TRUNC(SYSDATE) - 2

GROUP BY SUBSTR(TO_CHAR(A.CREATE_TIME, 'YYYY-MM-DD HH24:MI:SS'), 0, 13)

ORDER BY SUBSTR(TO_CHAR(A.CREATE_TIME, 'YYYY-MM-DD HH24:MI:SS'), 0, 13) DESC;

查询分钟:

SELECT SUBSTR(TO_CHAR(A.CREATE_TIME, 'YYYY-MM-DD HH24:MI:SS'), 0, 16), COUNT(1)

  FROM TABLE A

WHERE A.CREATE_TIME >= TRUNC(SYSDATE) - 2

GROUP BY SUBSTR(TO_CHAR(A.CREATE_TIME, 'YYYY-MM-DD HH24:MI:SS'), 0, 16)

ORDER BY SUBSTR(TO_CHAR(A.CREATE_TIME, 'YYYY-MM-DD HH24:MI:SS'), 0, 16) DESC;

上一篇 下一篇

猜你喜欢

热点阅读