-
Ranking equivelent in SQL server 2000?
There are three columns I need to query and rank, then group and total. I'm using MS SQL server 2000 and it doesn’t have a ranking function like the newer SQL server and oracle has. Does anyone have a clever way to create or simulate a ranking function? Thanks so much!
Jake
-
Unexiting approach is to make a cursor, sort it descending order and loop setting up the ranking field.
-
You can use a self join like this
select a.au_id, a.au_lname, a.au_fname, count(*) as 'rowid'
from authors a, authors b
where a.au_id >= b.au_id
group by a.au_id, a.au_lname, a.au_fname
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|