有时候会碰到行转列的需求(也就是将列的值作为列名称),通常我都是用 CASE END + 聚合函数来实现的。 如下: declare @t table (StudentName nvarchar(20), Subject nvarchar(20), Score int) Insert into @t (StudentName,Subject,Score) values ( '学生A', '中文', 80 ); Insert into @t (StudentName,Subject,Score) values ( '学生A', '数学', 78 ); Insert into @t (StudentName,Subject,Score) values ( '学生A', '英语', 92 ); Insert into @t (StudentName,Subject,Score) values ( '学生B', '中文', 89 ); Insert into @t (StudentName,Subject,Score) values ( '学生B', '数学', 87 ); Insert into @t (StudentName,Subject,Score) values ( '学生B', '英语', 75 ); Insert into @t (StudentName,Subject