题解 | #月均完成试卷数不小于3的用户爱作答的类别#
月均完成试卷数不小于3的用户爱作答的类别
http://www.nowcoder.com/practice/b1d13efcfa0c4ecea517afbdb9090845
第一次写题解做个纪念吧
select tag, count(*) as tag_cnt
from
examination_info
join
(
select * from
exam_record
where uid in
(
select uid from
(
select uid, count(*) as times
from exam_record
where submit_time is not NULL and
year(start_time)=2021 and month(start_time)=9
group by uid
having times>=3
)a
)
)b
using (exam_id)
# where submit_time is not NULL and
# year(start_time)=2021 and month(start_time)=9
group by exam_id
order by tag_cnt desc