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

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

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

select a.device_id,university,
sum(case when question_id is null then 0 else 1 end ),
sum(case when result like 'right' then 1 else 0 end ) as right_question_cnt
from user_profile as a
left join question_practice_detail as b
on a.device_id = b.device_id 
where university ='复旦大学' and (month(date)=8 or date is null)
group by a.device_id,university

全部评论
建立完关系后,在select展示全部字段 便可以看见虚拟表 ,在看着虚拟表写会比较容易
1 回复 分享
发布于 2023-12-10 07:18 湖北

相关推荐

评论
1
1
分享

创作者周榜

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