题解 | #统计每天刷题数超过5的user_id以及刷题数#

统计每天刷题数超过5的user_id以及刷题数

https://www.nowcoder.com/practice/852a14b888c448f1a26f0e2e20f668a7

#分组列称之为"聚合列",其他称之为"非聚合列"。非聚合列必须涉及函数否则报错

#select `date`, `user_id`, sum(pass_count) as total_pass_count from questions_pass_record_detail where pass_count>5 group by date

#没注意用where和having的区别
#select `date`, `user_id`, sum(pass_count) as total_pass_count from questions_pass_record_detail where pass_count>5 group by date,user_id 

select `date`, `user_id`, sum(pass_count) as total_pass_count from questions_pass_record_detail group by date,user_id having total_pass_count>5

全部评论
#group by后面有两个字段,输出列的行数还是根据第一个字段来的
点赞 回复 分享
发布于 2024-07-11 12:05 广东

相关推荐

不愿透露姓名的神秘牛友
11-19 14:56
点赞 评论 收藏
分享
评论
1
收藏
分享

创作者周榜

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