The group_concat function in MySQL can combine the specified fields of the group into one row of content, which is more suitable for column conversion.
The complete syntax is as follows:
group_concat([DISTINCT] Field to be concatenated [Order BY ASC/DESC sorting field] [Separator 'separator'])
The default delimiter is comma
Example:
select id,group_concat(distinct name) from table group by id;
It should be noted that there is a default limit on the length of the merged fields.
refer to:
HTTPS://wuwuwu.ITeye.com/blog/So-called never said-555543
HTTP://wuwuwu.mommycode.com/info-detail-1389878.HTML
HTTPS://wuwuwu.cn blog on.com/put Anson-2016/fear/6911631.HTML
HTTPS://wuwuwu.cn blog on.com/browser1214/fear/11202866.HTML