SELECT up.device_id device_id, up.university university, COUNT(qpd.question_id) question_cnt, SUM(IF(qpd.result = 'right', 1, 0)) right_question_cnt FROM user_profile up LEFT JOIN question_practice_detail qpd ON up.device_id = qpd.device_id AND qpd.date LIKE '2021-08%' WHERE up.university = '复旦大学' GROUP BY up.device_id;