mysql GROUP_CONCAT 函数 将相同的键的多个单元格合并到一个单元格

mysql GROUP_CONCAT 函数 将相同的键的多个单元格合并到一个单元格

MemberID          MemberName              FruitName
-------------- --------------------- --------------
1 Al Apple
1 Al Cherry

Desired output

MemberID           MemberName            FruitName
----------- -------------- ------------
1 Al Apple, Cherry
3down voteaccepted

GROUP BY MemberName and GROUP_CONCAT(FruitName). For example,

SELECT MemberId, MemberName, GROUP_CONCAT(FruitName) FROM a LEFT JOIN b ON a.MemberName = b.MemberName GROUP BY a.MemberName;
上一篇:javascript中制作简单的动态表单提交


下一篇:mysql—group_concat函数