在统计业务中,出现根据指定时间段查询并展示业务数据需求,无论业务数据是否存在,统计图中,需要展示指定时间段的每一天
set @startDate = '2022-12-01';
set @endDate = '2022-12-31';
SELECT
date_add( date_sub(@startDate,interval 1 day), INTERVAL ( cast( help_topic_id AS signed INTEGER )+1) day ) days
FROM mysql.help_topic
WHERE
help_topic_id < DATEDIFF(@endDate,date_sub(@startDate,interval 1 day))
ORDER BY
help_topic_id;