题解 | 统计每天刷题数超过5的user_id以及刷题数
统计每天刷题数超过5的user_id以及刷题数
https://www.nowcoder.com/practice/852a14b888c448f1a26f0e2e20f668a7
select date, user_id, sum(pass_count) total_pass_count from questions_pass_record_detail group by user_id, date having total_pass_count>5
当使用 GROUP BY
分组查询时,SELECT
列表中只能包含:
GROUP BY
子句中明确指定的列- 被聚合函数(如
SUM()
、COUNT()
、MAX()
等)处理的列