mysql 获取最近一个月每一天

  1. select date_add(curdate(), interval(cast(help_topic_id as signed integer) - 30) day) day
  2. from mysql.help_topic
  3. where help_topic_id < day(last_day(curdate()))
  4. order by help_topic_id

2019-07-03更新进一步格式化版


SELECT
	DATE_FORMAT( date_add( curdate( ), INTERVAL ( cast( help_topic_id AS signed INTEGER ) - 30 ) DAY ) , '%m/%d' ) DAY
FROM
	mysql.help_topic 
WHERE
	help_topic_id < DAY ( last_day( curdate( ) ) ) 
ORDER BY
	help_topic_id
原文地址:https://blog.csdn.net/qq_29384639/article/details/89563852
原文地址:https://www.cnblogs.com/jpfss/p/11129563.html