SQL中合并多行记录的方法总汇: –1. 创建表,添加测试数据 CREATE TABLE tb(id int, [value] varchar(10)) INSERT tb SELECT 1, ‘aa’ UNION ALL SELECT 1, ‘bb’ UNION ALL SELECT 2, ‘aaa’ UNION ALL SELECT 2, ‘bbb’ UNION ALL SELECT 2, ‘ccc’ –SELECT * FROM tb /**//* id value ———– ———- 1