If you are combining several rows in a MySQL query using a GROUP BY statement and still want to get a comma separated list of all the values of a particular column…
something like below:
Dataset:
ID Marks
1 20
2 30
3 40
Result Required:
IDs Sum(Marks)
1,2,3 90
you should be using the GROUP_CONCAT function of MySQL. Check out more of it at MySQL official documentation