//取每天的最大时间,与最小时间
SELECT STR_TO_DATE(CONCAT(monDays,'08:00:00'),'%Y-%m-%d %H:%i:%s') AS BEGINTIME ,DATE_ADD(STR_TO_DATE(CONCAT(monDays,'23:59:59'),'%Y-%m-%d %H:%i:%s'), INTERVAL 5 HOUR) AS BEGINTIME FROM ( SELECT DATE_FORMAT(DATE_ADD('2019-08-01',INTERVAL t.help_topic_id DAY),'%Y-%m-%d') AS 'monDays' FROM mysql.help_topic t WHERE t.help_topic_id < DAY(LAST_DAY('2012-08-01')) ) contDay;