SELECT DATE_FORMAT(DATE_ADD(
CONCAT(YEAR(DATE(CONCAT('2021','-12-01'))),'-01- 01'),INTERVAL(CAST( help_topic_id AS SIGNED INTEGER))MONTH),'%Y-%m') dateForMonth
FROM mysql.help_topic
WHERE help_topic_id <12
selectleft(created_time,7)AS checkTime,count(1)AS totalNum
from student_info
whereleft(created_time,4)='2021'groupby checkTime
select
monthTable.dateForMonth,casewhen dataTable.totalNum isnullthen0else dataTable.totalNum end totalNum
from(SELECT DATE_FORMAT(DATE_ADD(
CONCAT(YEAR(DATE(CONCAT('2021','-12-01'))),'-01-01'),INTERVAL(CAST( help_topic_id AS SIGNED INTEGER))MONTH),'%Y-%m') dateForMonth
FROM mysql.help_topic
WHERE help_topic_id <12ORDERBY dateForMonth
)AS monthTable
leftjoin(selectleft(created_time,7)AS checkTime,count(1)AS totalNum
from student_info
whereleft(created_time,4)='2021'groupby checkTime)AS dataTable
on monthTable.dateForMonth = dataTable.checkTime