题解 | #月总刷题数和日均刷题数#
月总刷题数和日均刷题数
https://www.nowcoder.com/practice/f6b4770f453d4163acc419e3d19e6746
select date_format(submit_time,"%Y%m") submit_month, round(count(submit_time),3) month_q_cnt, any_value(round(count(submit_time)/day(LAST_DAY(submit_time)),3)) avg_day_q_cnt from practice_record where year(submit_time)='2021' group by submit_month union all select concat(year(submit_time),'汇总') submit_month, round(count(submit_time),3) month_q_cnt, round(count(submit_time)/31,3) avg_day_q_cnt from practice_record where year(submit_time)='2021' group by submit_month order by submit_month ; 这题目还是挺难的