select tb1.device_id, university, count(date), count(if(result='right',1,null)) from user_profile tb1 left join question_practice_detail tb2 using(device_id) where (date_format(date,'%Y%m')='202108' or date is null) and university='复旦大学' group by tb1.device_id, university