发现一个有趣的问题,如果把 if(result = 'right' ,1,0) 放在t2子表中,结果会报错,在8月没有答题过的学生,他的正确回复返回的是 null。为什么呢?看完代码后,往下看select t1.device_id,t1.university,count(question_id) as question_cnt ,sum(if(result = 'right' ,1,0)) as right_question_cntfrom(select device_id,universityfrom user_profilewhere university = '复旦大学')t1l...