Mysql数据库多行记录的某一字段,根据分组合并group_concat
程序员文章站
2024-01-03 18:42:22
...
mysql多行记录的某一字段,根据分组进行合并,合并的数据用逗号分隔开
使用以下SQL语句的执行结果
SELECT
school_id,
grade,
sex,
group_concat(physical_item) as physical_item
FROM
phy_examination_items
GROUP BY
school_id,
grade,
sex