#今日2024-07-29
SELECT
DATE_FORMAT( DATE_ADD( NOW(), INTERVAL -(CAST( help_topic_id AS SIGNED INTEGER )) MONTH ), '%Y-%m' ) months
FROM
mysql.help_topic
WHERE
help_topic_id <= TIMESTAMPDIFF(MONTH, CONCAT(DATE_FORMAT(CURDATE(), "%Y-01-01")),CONCAT(STR_TO_DATE(CURDATE(), '%Y-%m-%d')))
ORDER BY months asc;
效果: