SORTING COLUMNS IN TSQL

  • 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.

  • Please avoid double or triple posting your questions. It only servers to fragment any answers you may get.

    Please post any replies here: http://www.sqlservercentral.com/Forums/Topic644677-338-1.aspx

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply