题解 | #月均完成试卷数不小于3的用户爱作答的类别#
月均完成试卷数不小于3的用户爱作答的类别
https://www.nowcoder.com/practice/b1d13efcfa0c4ecea517afbdb9090845
select tag, count(start_time) tag_cnt # 计算作答次数 from exam_record er inner join examination_info ei on er.exam_id = ei.exam_id where uid in (select uid # 子查询确定uid 在“当月均完成试卷数”不小于3的用户们 from exam_record where date_format(start_time,'%Y-%m') = '2021-09' group by uid having count(submit_time) >= 3) group by tag order by tag_cnt desc;