943,718 Members | Top Members by Rank

Ad:
  • MySQL Discussion Thread
  • Unsolved
  • Views: 403
  • MySQL RSS
Apr 30th, 2009
0

Assign Record Numbers to Records

Expand Post »
In a application for online test, the rank list is computed as follows-
MySQL Syntax (Toggle Plain Text)
  1. SELECT * FROM test ORDER BY marks DESC

How can we make sure that the first record gets rank1, second rank2 and so on... I want to add the field to the table.

Can this be done using a single pass? As in,a workaround is to create a temp table using the query and then process each record using a script to assign the rank. Is it possible without the script?
Last edited by tuse; Apr 30th, 2009 at 10:28 am.
Similar Threads
Reputation Points: 32
Solved Threads: 14
Junior Poster
tuse is offline Offline
173 posts
since Jul 2007

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in MySQL Forum Timeline: Create a Form Calculator in MySQL
Next Thread in MySQL Forum Timeline: Transferring a db from one server to another server.





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC