```select
    exam_id tid,
    count(distinct uid) uv,
    count(exam_id) pv
from exam_record
group by tid
union 
select 
    question_id tid,
    count(distinct uid) uv,
    count(question_id) pv
from practice_record
group by tid
order by left(tid,1) desc,uv desc,pv desc