from子查询作为临时表 select t.university,count(t.device_id)/(count(distinct t.device_id)) from(select u.university,q.device_id,q.result from user_profile u right join question_practice_detail q on u.device_id=q.device_id) t group by t.university;