select student_id,sum(course_id)from learn
select student_id,count(course_id)from learn group by student_id
select student_id,count(course_id)from learn
select student_id,sum(course_id)from learn group by student_id
group by student_id是按学生号分组,每个编号的学生可能有多门课程,但不可能课程编号会重复,所以直接使用count(course_id),否则就要使用count(disctinct(course_id))
这道题你会答吗?花几分钟告诉大家答案吧!
扫描二维码,关注牛客网
下载牛客APP,随时随地刷题