|
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2000-12-28 : 17:48:34
|
Lambo writes "Hi, I have a table called standings which I'm displaying in an ASP page retrieved from sql server 2000 query. The two main fields are score, and name. I would like the query to return the score, number, and row number the way it would be if it were sorted by score descending, but i want the rows to be sorted by name. I can't really describe this well, so I'll give you an example. If I had a table called standings, and it had the following data (Name, Score): ('John', 100) ('Mark', 200) ('David', 300). I want the table to be sorted by score descending, with a row number, so now it would be (RowNum, Name, Score): (1, 'David', 300) (2, 'Mark', 200) (3, 'John', 100). Then I want this query sorted by name, so it would be (RowNum, Name, Score): (1, 'David', 300) (3, 'John', 100) (2, 'David', 200) in that order.
I know I can retrieve the data, and sort it manually in the ASP code, but I was wondering whether it's possible to have SQL server do it by itself." |
|