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


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM