Ask the MYSQL database under the SQL how to write statement

ID name
1 Zhang San
1 Li Si
1 Wang Wu
2 1
2 2
2 3

The results you want

1 pieces of three, Li Si, Wang Wu
2 1,2,3

Online can be used on the node with

Started by Josie at December 23, 2013 - 7:40 PM

select group_concat(name) from tt group by id

Posted by Kyle at December 30, 2013 - 8:32 PM

select group_concat(name) from table group by ID
Use the group_concat function

Posted by Teresa at January 14, 2014 - 9:17 PM

select id,group_concat(name) from tt group by id

Posted by Ed at January 15, 2014 - 9:43 PM

select id,group_concat(name)
from tb
group by id;

Posted by Kathie at January 28, 2014 - 9:49 PM

select ID,GROUP_CONCAT(name)
from table1
group by ID;

Posted by Ogden at February 07, 2014 - 10:13 PM