Concatenating records in a single column without looping?

前端 未结 5 980
南方客
南方客 2021-01-06 08:27

I have a table with 1 column of varchar values. I am looking for a way to concatenate those values into a single value without a loop, if possible. If a loop is the most e

5条回答
  •  遥遥无期
    2021-01-06 09:02

    If it is MySQL, you can use GROUP_CONCAT

    SELECT a, GROUP_CONCAT(b SEPARATOR ',') FROM table GROUP BY a;

提交回复
热议问题