0

E.g. of a student table:

student_name   marks    roll_number
Kai            10       1234
Kai            20       1234
Kante          30       1111
Kante          40       1111

Output I want:

student_name   marks     roll_number
Kai            [10,20]   1234
Kante          [30,40]   1111
Zizou
  • 65
  • 5
  • What's the rational for doing this? It violates normalization principles and in order to be useable for any aggregation you'll have to undo this process. Also, tag the version of SQL you're using, the answer in this case will likely be dependent on which variation you're using. For example MySQL has a function called GROUP_CONCAT(), while others will require a function like seen here - https://stackoverflow.com/questions/6899/how-to-create-a-sql-server-function-to-join-multiple-rows-from-a-subquery-into – procopypaster Feb 23 '22 at 04:27

0 Answers0