Here's an exampleDECLARE @Table Table (Col1 int,Col2 int,Col3 int,Col4 int)--The above is the DDL,which should have been providedINSERT INTO @tableSELECT 1,6,8,24-- this is the sample data, which should have been provided-- The below is the DML, which I gave as a solution. Even if you DML-- doesn't work, provide it anyway, as it can give us a better idea --of what you're trying to accomplish-- do these things and you'll find you go to the front of line!JimSELECT *FROM(select Col,ColNames,rank() over(order by ColNames desc) as Biggestfrom (select col1,col2,col3,col4from @table)pvtUNPIVOT(ColNames FOR Col in (Col1,Col2,Col3,Col4)) as unpvt) tWHERE biggest = 1
JimEveryday I learn something that somebody else already knew