Oracle statistics statement by day
Oracle statistics statement by day the –Create table Test CTEATE TABLE TEST( ID NUMBER NOT NULL, MODIFIEDTIME DATE NOT NULL ) –Statistics by day SELECT TO_CHAR(T.MODIFIEDTIME,’YYYY-MM-DD’) TIME,COUNT(*) COUNT FROM TEST T www.2cto.com –You can add query conditions here WHERE TO_CHAR(T.MODIFIEDTIME,'YYYY') = TO_CHAR(SYSDATE,'YYYY') GROUP BY TO_CHAR(T.MODIFIEDTIME,'YYYY-MM-DD') –Group by date ORDER BY TO_CHAR(T.MODIFIEDTIME, & # 39; YYYY-MM-DD & # 39;) ASC NULLS LAST — Sort by date the — Note: MODIFIEDTIME is the time field in the table TEST, the time type –The above code can be run directly in the database –If there is a quantity field in the table, if you want to count the quantity by day, you can change COUNT(*) to SUM(1) function the Author guoxuepeng123