题解 | #统计复旦用户8月练题情况#
统计复旦用户8月练题情况
http://www.nowcoder.com/practice/53235096538a456b9220fce120c062b3
select
u1.device_id,u1.university,count(q.question_id),
sum(case when q.result='right' then 1 else 0 end )
from user_profile u1 left join question_practice_detail q on u1.device_id=q.device_id
WHERE
u1.university='复旦大学'
and
(month(q.date) =8 or month(q.date) is null)
group by u1.device_id