//按月统计近六个月的数据
SELECT
TO_CHAR (drive_lic_iss_ctf_dt,
'yyyy-MM'
),
COUNT (*)
FROM
T02_PRACT_H
WHERE
to_char(drive_lic_iss_ctf_dt,'yyyy-mm') > to_char(sysdate-interval'6'month,'yyyy-mm')
AND
to_char(sysdate+interval'1'month,'yyyy-mm') > to_char(drive_lic_iss_ctf_dt,'yyyy-mm')
GROUP BY
TO_CHAR (
drive_lic_iss_ctf_dt,
'yyyy-MM'
)
order BY
TO_CHAR (
drive_lic_iss_ctf_dt,
'yyyy-MM'
) desc
;