题解 | #月均完成试卷数不小于3的用户爱作答的类别#
月均完成试卷数不小于3的用户爱作答的类别
https://www.nowcoder.com/practice/b1d13efcfa0c4ecea517afbdb9090845
select tag, count(tag) as tag_cnt from exam_record join examination_info using(exam_id) where uid in ( select uid from exam_record where submit_time is not null group by uid having count(exam_id) / count(distinct DATE_FORMAT(start_time, "%Y%m")) >= 3 ) group by tag order by tag_cnt desc
本题讲的是月均完成数不小于3,也就是说每个月完成3个考试,且考试类型可以重复