题解 | #统计每天刷题数超过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