题解 | #未完成试卷数大于1的有效用户#
月均完成试卷数不小于3的用户爱作答的类别
http://www.nowcoder.com/practice/b1d13efcfa0c4ecea517afbdb9090845
select ei.tag
,count(*) as tag_cnt
from exam_record er left join examination_info ei
on er.exam_id=ei.exam_id
where er.uid in
(select uid
from
(
select
uid
,avg(a.月完成数) as 月均完成数
from
(select
uid
,month(start_time)
,count(*) as 月完成数
from exam_record
where score is not null
group by 1,2
)a
group by 1
)b where b.月均完成数>=3)
group by 1
order by 2 desc