http://stackoverflow.com/questions/8543218/display-cell-value-as-column-name-using-sql
Q&A for programmers
-- Pivot table without aggregate function -- http://stackoverflow.com/questions/8543218/display-cell-value-as-column-name-using-sql declare @test table( Name varchar(30) not null, Grade varchar(10) not null, Subject varchar(10) not null ) insert into @test values('Ami', 'HD', 'Java') insert into @test values('Ami', 'D', 'C++') insert into @test values('Bec', 'D', 'Java') insert into @test values('Bec', 'P', 'C++') select Name, Max(case Subject when 'C++' then Grade end) 'C++', Max(case Subject when 'Java' then Grade end) 'Java' from @test group by Name
Error: looks like you typed in the wrong words - try again