I am trying to set the following formated value to appear in one row. This is hard for me to explain as I do not know the right term. I am trying to do this in MySQL. I am not able to figure out how can I concatenate to side by side in one row, without duplicating.
Any guidance or help is highly appreciated.
Thank you.
CodePudding user response:
You can do it by using the GROUP_CONCAT
function:
SELECT
Name,
GROUP_CONCAT(Mark SEPARATOR ',') AS Marks
FROM
tab
GROUP BY
Name
Here's a fiddle: https://dbfiddle.uk/?rdbms=mysql_8.0&fiddle=4e73f6b00fe5a193a4fb5b43d4931658.