-- 1.统计出当月完成次数>=3的有哪些用户(去重)
-- 2.统计这些用户作答了哪些试卷(去重)
-- 3.统计这些试卷的作答次数
select t3.tag,count(t2.exam_id) tag_cnt
from exam_record t2, examination_info t3
where
t2.uid in (
select distinct t1.uid t1_uid
from
(
select uid , count(uid) cnt_uid
from exam_record
where score is not null
group by left(start_time , 7) , uid
having cnt_uid >= 3
) t1
)
and t2.exam_id = t3.exam_id
group by t2.exam_id
order by tag_cnt desc

京公网安备 11010502036488号