Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
davidpardoe
Constraint Violating Yak Guru
324 Posts |
Posted - 2001-09-05 : 07:32:09
|
| Does anyone have any design suggestions for the following situation...I have a table with say 5 fields plus an URN (ultimately I would like this to work with any number of fields). I wish to be able to select the field with the highest value for each row. For example I have the table:-URN Col1 Col2 Col3 Col4 Col5============================1 10 11 12 13 142 11 10 14 12 133 14 13 12 10 11My result set should be something like:-URN MaxCol==========1 Col52 Col33 Col1In addtion I would like to be able to specify which columns should be compared. For the above data I may want to exclude Col1 from my comparison, resulting in:-URN MaxCol==========1 Col52 Col33 Col2Any thoughts.Might it be easier to do if I create a new table with 1 row per "Col" value - ie. in the above case I would have 5 lines per URN?Any help would be invaluable.============The Dabbler! |
|
|
|
|
|