您的位置: 首页 > 文章 > MySQL GROUP_CONCAT MySQL GROUP_CONCAT 分类: 文章 • 2024-02-11 22:05:52 GROUP_CONCAT 用来合并字段使用 SELECT store_id FROM istore 原始数据是这样的 需求想合并多行数据为一行数据 SELECT GROUP_CONCAT(store_id ) from (SELECT store_id FROM store GROUP BY store_id ) a 注意事项: GROUP_CONCAT后面必须紧连着字段,不能有空格 group by 字段必须和 group_concat 字段必须一致