with t1 as (
select exam_id as tid, count(distinct uid) as uv, count(uid) as pv
from exam_record
group by tid
order by uv desc, pv desc
)
select tid, uv, pv
from t1
union all
select *
from (
(select question_id as tid, count(distinct uid) as uv, count(uid) as pv
from practice_record
group by tid
order by uv desc, pv desc)
) as c;

京公网安备 11010502036488号