Last post Jan 27, 2015 12:13 PM by psm_8210
Jan 27, 2015 11:41 AM|psm_8210|LINK
I am stuck in writing a SQL query using PIVOT. I googled it but most of the examples have pivot aggregate example.
Here is the my data set and the requeried data set.
In the requried data set the JudgeID is shown in three different columns based on Candidate, Type, Category
please help me in the pivot example.
Jan 27, 2015 12:00 PM|gimimex|LINK
with CTE_RN as
ROW_NUMBER() OVER(PARTITION BY CandidateIdentifier, [Type], Category
ORDER BY CandidateIdentifier) as RN
 as Judge_I,
 as Judge_II,
 as Judge_III
max(JudgeID) for RN in (, , )
) as PivotTable
Hope this helps.
Jan 27, 2015 12:13 PM|psm_8210|LINK
Awesome, your solution seems to be working. I will try to understood the code you gave.