题解 | #统计复旦用户8月练题情况#

统计复旦用户8月练题情况

https://www.nowcoder.com/practice/53235096538a456b9220fce120c062b3

-- 需要关联两张表,根据题目说没有练习过的用户,答题数结果返回0,所以我们用left join保全左边所有用户。
-- 限定条件:复旦大学 university='复旦大学',8月份练习,且答题正确result='right'

--需要根据用户分组 group by device_id。
select t1.device_id,t1.university,
count(t2.question_id) as question_cnt,
sum(if(t2.result='right',1,0)) as right_question_cnt
from user_profile as t1
left join question_practice_detail as t2
on t1.device_id = t2.device_id
where t1.university = '复旦大学' and (month(t2.date)='08'or month(t2.date) is null )
group by t1.device_id;

全部评论

相关推荐

Java大菜狗:纯纯招黑奴,一天还不到两百那么多要求,还不迟到早退,以为啥啊,给一点工资做一堆活,还以不拖欠员工工资为荣,这是什么值得骄傲的事情吗,纯纯***公司
点赞 评论 收藏
分享
06-10 23:36
已编辑
首都经济贸易大学 C++
点赞 评论 收藏
分享
07-15 14:14
门头沟学院 Java
7.10投递7.15感谢信
投递地平线等公司7个岗位
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务