select device_id, university, count(1) as question_cnt, sum(result = 'right') as right_question_cnt from question_practice_detail inner join user_profile using(device_id) where university = '复旦大学' and date_format(date,'%m') = '08' group by device_id