select uir.account, GROUP_CONCAT(r.name SEPARATOR ‘,‘) as roles from kt_user_info_role uir left join kt_sys_role r on uir.role_id = r.id GROUP BY uir.account
mysql GROUP_CONCAT多行合并为一条记录
原文:https://www.cnblogs.com/modestlin/p/14543222.html