'How do I get one to many values in to one row in sql?
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.
Solution 1:[1]
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.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | lemon |

