SELECT TO_CHAR(T.create_time,'YYYY-MM-DD') TIME,COUNT(*) COUNT FROM test T GROUP BY TO_CHAR(T.create_time,'YYYY-MM-DD') ORDER BY TO_CHAR(T.create_time,'YYYY-MM-DD') ASC NULLS LAST
SELECT TO_CHAR(T.create_time,'YYYY') YEAR,TO_CHAR(T.create_time,'IW') TIME,'IW'),TO_CHAR(T.Trade_time,'YYYY') ORDER BY TO_CHAR(T.create_time,'YYYY'),'IW') ASC NULLS LAST
SELECT TO_CHAR(T.create_time,'YYYY-MM') TIME,'YYYY-MM') ORDER BY TO_CHAR(T.create_time,'YYYY-MM') ASC NULLS LAST
SELECT TO_CHAR(T.create_time,'Q') TIME,'Q'),'Q') ASC NULLS LAST
SELECT TO_CHAR(T.create_time,'YYYY') ASC NULLS LAST
注:create_time为表TEST里的创建时间字段,时间类型 以上代码可直接在数据库里运行