Results 1 to 3 of 3

Thread: Ranking equivelent in SQL server 2000?

  1. #1
    Join Date
    Sep 2005
    Location
    Georgia
    Posts
    2

    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

  2. #2
    Join Date
    Aug 2005
    Posts
    31
    Unexiting approach is to make a cursor, sort it descending order and loop setting up the ranking field.

  3. #3
    Join Date
    Nov 2002
    Location
    New Jersey, USA
    Posts
    3,932
    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
  •