题解 | 统计复旦用户8月练题情况
select tt1.device_id,university,sum(tt1.question) as question_cnt,sum(right_question) as right_question_cnt from (select t1.device_id,university,case when month(date) = 8 then 1 else 0 end as question,if(result = 'right',1,0) as right_question from user_profile t1 left join question_practice_detail t2 on t1.device_id = t2.device_id where university = '复旦大学') as tt1 group by tt1.device_id
我这种可以吗