题解 | #北京大学或练题数大于2的学生ID#

北京大学或练题数大于2的学生ID

https://www.nowcoder.com/practice/b2b639586d89409b9c1fa82c083287dd

#求出每一个学生的练题数量
#select device_id,count(question_id)count  from question_practice_detail
#group by device_id
#having count>2;

#select a.device_id,a.university,b.count
#from user_profile a
#left join 
#(select device_id,count(question_id)count  from question_practice_detail
#group by device_id
#having count>2) b
#on a.device_id=b.device_id ;


select c.device_id
from
(select a.device_id,a.university,b.count
from user_profile a
left join 
(select device_id,count(question_id)count  from question_practice_detail
group by device_id
having count>2) b
on a.device_id=b.device_id)c
where c.university='北京大学' or c.count >2 order by c.device_id desc;
全部评论

相关推荐

评论
1
收藏
分享

创作者周榜

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