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 |
|
indra7
Starting Member
5 Posts |
Posted - 2006-05-22 : 14:48:23
|
| ok,I created a view of just one table that's sorted by an int field called TotalScore.What I want to do is create a new field within the View (called 'Rank')that will have the ranking of the sort order.In other words, the field with highest value in 'TotalScore' should have a '1' in the 'Rank' field.Any ideas on how to do this?Thanks. |
|
|
Srinika
Master Smack Fu Yak Hacker
1378 Posts |
Posted - 2006-05-22 : 15:17:39
|
| Give some sample data and expected resultsSrinika |
 |
|
|
indra7
Starting Member
5 Posts |
Posted - 2006-05-22 : 17:48:13
|
| Given this View:CREATE VIEW [View_SSZ] AS select Top 3 Color,TotPointsfrom tblColororder by TotPoints descwhereColor,TotPoints Blue, 36Red, 33Yellow, 29I'd like to see:Ranking,Color,TotPoints 1, Blue, 362, Red, 333, Yellow, 29Thanks. |
 |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
|
indra7
Starting Member
5 Posts |
Posted - 2006-05-22 : 19:54:49
|
| It works beautifully.Thanks. |
 |
|
|
|
|
|
|
|