关键点 group by 和 group_concat()
eg
id city people
1 Hangzhou Tom
1 Hangzhou Jack
3 Guangzhou Mary
select id ,city,group_concat(people) as people
from city
group by id;
id city people
output
1 Hangzhou Tom,Jack
3 Guangzhou Mary
关键点 group by 和 group_concat()
eg
id city people
1 Hangzhou Tom
1 Hangzhou Jack
3 Guangzhou Mary
select id ,city,group_concat(people) as people
from city
group by id;
id city people
output
1 Hangzhou Tom,Jack
3 Guangzhou Mary
本文标题:多条记录合并
本文链接:https://www.haomeiwen.com/subject/jqroxttx.html
网友评论