I have these two tables.
Student
id | name
1 A
2 B
Assignment
id | Student | Section
1 1 1
2 1 2
3 1 3
4 2 2
5 3 3
6 3 4
And I'm expecting to have the result pivot into dynamic number of columns.
Student | s1 | s2 | s3
A 1 2 3
B 2
C 3 4
Is it something feasible? I have used GROUP_CONCAT
but that gives me a long concatenated string I'm thinking if it can be parsed into columns. The column names are not important I wonder how I should alias it. Any hints are appreciated, thanks a lot.