题解 | #统计每个学校各难度的用户平均刷题数#

统计每个学校各难度的用户平均刷题数

http://www.nowcoder.com/practice/5400df085a034f88b2e17941ab338ee8

1.两张小表先关联        
2.再和 user_profile表关联
3.分组  group by university,difficult_level
4.count(question_id)/count(distinct u.device_id)  总的答题数量除答题人数

select university,difficult_level,count(question_id)/count(distinct u.device_id)
from user_profile u,(select x.*,y.difficult_level
                     from question_practice_detail x,question_detail y
                     where x.question_id = y.question_id) as m
where u.device_id = m.device_id
group by university,difficult_level


全部评论

相关推荐

秋盈丶:后续:我在宿舍群里和大学同学分享了这事儿,我好兄弟气不过把他挂到某脉上了,10w+阅读量几百条评论,直接干成精品贴子,爽
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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