查询某月的每一天

 

 

1
ADDDATE(CURDATE(),INTERVAL 0 MONTH),当月,或者CURDATE()也行,
1
ADDDATE(CURDATE(),INTERVAL -1 MONTH),上个月的每一天
1
2
3
4
select date_add(ADDDATE(CURDATE(),INTERVAL 0 MONTH), interval(cast(help_topic_id as signed integer) - DATE_FORMAT( DATE_SUB( curdate( ), INTERVAL 1 DAY ), '%d' )) day) day
from mysql.help_topic
where help_topic_id < day(last_day(curdate()))
order by help_topic_id

  

posted @   天妖姥爷  阅读(210)  评论(0编辑  收藏  举报
努力加载评论中...
点击右上角即可分享
微信分享提示