I want to change rows into column as it is.. means without any aggregate function on coming answer. like i have 2 columns as ExamType and Obtained marks 1st will contains the values like
ExamTypeCode ObtainedMarks
1 18
2 20
3 45
1 15
2 22
3 47
and i want the data like following without any aggregate function
1 2 3
----------------
18 20 45
15 22 47
I have tried the following query , its giving me ans but not like which i want
- SELECT *
- FROM
- (
- SELECT StudentRegCode,ExamTypeCode,ObtainedMark FROM StudentSubjectMark
- ) AS SourceTable
- PIVOT
- (MIN([ObtainedMark]) FOR [ExamTypeCode] IN([1],[3],[4])) AS PivotTable;

sudipta sanyalRank #1,945 · 753 reputationPosted Mar 15, 2018, 1:54 AM EDT
Nitin SontakkeRank #264 · 9.6K reputationPosted Mar 14, 2018, 11:10 PM EDT