select up1.device_id,university,count(question_id) question_cnt, sum(if(result='right',1,0)) as right_question_cnt from (select device_id,university from user_profile where&n...