Hi, i've the next table:
sect peter mark david 1st who 2nd who2 3th who3
1 274 39 15 274 peter 39 mark 15 david
2 211 320 6
3 281 67 18
4 323 690 7
5 234 40 8
for each row I need to know which of the columns of peter, mark and david, has the highest value and who. So for the sect=1 the highest value is peter with 274, also who are the 2nd and the 3rd with their respective values.
I'm doing that using select ..unpivot and select ....pivot , any other ideas?
thanks.