I have a StudentMarks table with columns Name, Maths, Science, English . The data is similar to
Name, Maths, Science, English Tilak, 90, 40, 60 Raj, 30, 20, 10
I want to configure it as follows:
Name, Subject, Marks Tilak, Maths, 90 Tilak, Science, 40 Tilak, English, 60
With univot, I can correctly identify Name, Marks, but could not get the column name in the source table in Subject in the desired result set.
How can i achieve this?
I still got to the next request (to get Name, Marks)
select Name, Marks from studentmarks Unpivot ( Marks for details in (Maths, Science, English) ) as UnPvt
sql sql-server tsql sql-server-2008 unpivot
Tilak Sep 27 '13 at 16:37 2013-09-27 16:37
source share