![]() |
|
#1
|
|||
|
|||
Sorting a table to give each user a rankIn MySQL I have a table of users and many details about them. The problem I have is that I want to give each user a rank based on their level - the highest level = rank1, etc. I have a table, called users. I then want to give each user a rank based on their value in a column called LEVEL. The name of the user is in a column called USER. Can you suggest some code that would work for this situation. I cannot think how I would apply a rank for each users and have been stumped on this for some time.
Thanks |
|||
|
#2
|
|||
|
|||
|
I don't really understand your question. If you want to sort the users based on their level and then apply some rank, I can't see what's so hard.
SELECT user,level FROM users ORDER BY level DESC Then go through them, one at a time, and apply your ranks. To me it would seem foolish to include this rank in the table, since it would seem as if it can be computed from the level anyway. |
Recent GIDBlog
Toyota - 2009 May Promotion by Nihal
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| [Include] Doubly-linked List | dsmith | C Programming Language | 6 | 14-Apr-2006 14:12 |
| Hash Table & Graph | Kay Chan | C++ Forum | 7 | 08-Oct-2004 08:44 |
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The