Mysqlは、年と月に従って当月の毎日をトラバースします

select CONCAT('2020-02','-',help_topic_id +1)  day,help_topic_id,day(last_day( CONCAT('2020-02','-1'))) as dayT
from mysql.help_topic
where help_topic_id  < day(last_day(CONCAT('2020-02','-1')))
order by help_topic_id

ここに画像の説明を挿入

其中'2020-02'是传入得值,last_day( CONCAT('2020-02','-1'))是查询当月最后一天
day(last_day( CONCAT('2020-02','-1')))是获取当前月份一共有多少天

おすすめ

転載: blog.csdn.net/zhongzih/article/details/105999597