题解 | #试卷发布当天作答人数和平均分#
试卷发布当天作答人数和平均分
http://www.nowcoder.com/practice/5b58e89556dc4153a79d8cf8c08ba499
select exam_id,count(distinct t1.uid) as uv, round(avg(score),1) as avg_score from exam_record t1 join user_info t2 on t1.uid = t2.uid and t2.level > 5 where (exam_id,date_format(start_time,'%Y%m%d')) in ( select exam_id,date_format(release_time,'%Y%m%d') as re_day from examination_info where tag = 'SQL' ) group by exam_id order by uv desc,avg_score