“Group concat”的版本间的差异

来自姬鸿昌的知识库
跳到导航 跳到搜索
(建立内容为“1”的新页面)
 
第1行: 第1行:
1
+
<syntaxhighlight lang="sql">
 +
select student_id, group_concat(course_id)
 +
from score
 +
group by student_id
 +
</syntaxhighlight>
 +
{|
 +
!student_id
 +
!group_concat(course_id)
 +
|-
 +
|1
 +
|1
 +
|-
 +
|2
 +
|1,2
 +
|-
 +
|3
 +
|1,2,3
 +
|-
 +
|4
 +
|1,2,3,3
 +
|-
 +
|5
 +
|1,1
 +
|-
 +
|6
 +
|2,3
 +
|}

2024年7月10日 (三) 02:10的版本

select student_id, group_concat(course_id)
from score
group by student_id
student_id group_concat(course_id)
1 1
2 1,2
3 1,2,3
4 1,2,3,3
5 1,1
6 2,3