Select 检验单号,批号,max(Case When 测试项 = '霉菌酵母菌' Then 结论 Else NULL End) As ’霉菌酵母菌‘,max(Case When 测试项 = '需氧菌' Then 结论 Else NULL End) As ’需氧菌‘,max(Case When 测试项 = '含量' Then 结论 Else NULL End) As ’含量‘ ,max(Case When 测试项 = '大肠埃希菌' Then 结论 Else NULL End) As ‘大肠埃希菌’ From {学生成绩} Group by 检验单号,批号