GROUP_CONCAT(字段)
GROUP_CONCAT(字段 separator "分隔符")
GROUP_CONCAT(DISTINCT 字段 ORDER BY 字段 SEPARATOR "分隔符")
SELECT
employeeNumber,
firstName,
lastName,
GROUP_CONCAT(DISTINCT customername ORDER BY customerName)
FROM
employees
INNER JOIN customers ON customers.salesRepEmployeeNumber = employeeNumber
GROUP BY employeeNumber
ORDER BY firstName,lastname
CONCAT_WS("分隔符",str1,str2,...)
SELECT
CONCAT_WS(‘;‘,o.user_code,o.user_name)
FROM sys_user o
WHERE id = 5201314
CONCAT(str1,str2...)
SELECT
CONCAT(o.user_code,o.user_name)
FROM sys_user o
WHERE id = 5201314
MySQL数据库的函数的使用:使用字符串拼接函数实现MySQL查询结果的拼接
原文:https://www.cnblogs.com/chova/p/15154416.html