select * from( ( select exam_id as tid, count(distinct uid) uv, count(start_time) pv from exam_record group by exam_id order by uv desc, pv desc ))a union all select * from( ( select question_id as tid, count(distinct uid) uv, count(submit_time) pv from practice_record group by question_id order by uv desc, pv desc ))b