多行同一字段合并

mysql分组后将同组多行记录的某个字段合并成一条记录的某个字段,中间用逗号分开
select ID,group_concat(NAME) as NAME from table group by ID;
select ID,group_concat(NAME SEPARATOR ';') as NAME from table group by ID;

猜你喜欢

转载自fanyoule.iteye.com/blog/2342062