SELECT submit_month, COUNT(question_id) month_q_cnt, ROUND(COUNT(question_id) / day, 3) avg_day_q_cnt FROM ( SELECT DATE_FORMAT(submit_time, '%Y%m') submit_month, question_id, DAY(LAST_DAY(submit_time)) day FROM practice_record WHERE DATE_FORMAT(submit_time, '%Y') = 2021 ) tb GROUP BY submit_month, day UNION SELECT '2021汇总' submit_month, COUNT(question_id) month_q_cnt, ROUND(COUNT(question_id) / 31, 3) avg_day_q_cnt FROM practice_record WHERE DATE_FORMAT(submit_time, '%Y') = 2021 ORDER BY submit_month;