生成本月每日的时间序列
SELECT
DATE_FORMAT(date_add(
CONCAT(YEAR(Date(curdate())),'-0',MONTH(Date(curdate())),'-','01'),
INTERVAL ( cast( help_topic_id AS signed) ) DAY
) ,'%Y-%m-%d' )
FROM
mysql.help_topic
WHERE
help_topic_id < DAY ( curdate( ) )
ORDER BY
help_topic_id
生成本年每月的时间序列
SELECT
DATE_FORMAT( DATE_ADD( CONCAT(YEAR(Date(curdate())),'-0',MONTH(Date(curdate())),'-','01'), INTERVAL CAST( help_topic_id AS SIGNED INTEGER ) MONTH ), '%Y-%m' ) as month
FROM
mysql.help_topic
WHERE
help_topic_id < 12;