MySQL获取当月日期

select date_add(curdate(), interval(cast(help_topic_id as signed integer) 
- DATE_FORMAT( DATE_SUB( curdate( ), INTERVAL 1 DAY ), '%d' )) day) RQ
from mysql.help_topic
where help_topic_id  < day(last_day(curdate()))
order by help_topic_id

 

Guess you like

Origin blog.csdn.net/wt5264/article/details/102589011