1

Here is my table information

Id Name
1 aaa
1 bbb
2 ccc
2 ddd

Ids are the repeated one. Now I want the result like

1 aaa,bbb
2 ccc,ddd

How can I do that in Mysql ?

juergen d
  • 195,137
  • 36
  • 275
  • 343
ram
  • 53
  • 1
  • 9

1 Answers1

7

Use GROUP_CONCAT()

select id, group_concat(name) as names
from your_table
group by id
juergen d
  • 195,137
  • 36
  • 275
  • 343