GIDForums  

Go Back   GIDForums > Computer Programming Forums > MySQL / PHP Forum
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 08-Apr-2005, 14:01
Wowl Wowl is offline
New Member
 
Join Date: Apr 2005
Posts: 1
Wowl is on a distinguished road

Sorting a table to give each user a rank


In 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  
Old 23-Apr-2005, 15:45
cyner cyner is offline
New Member
 
Join Date: Apr 2005
Posts: 4
cyner is on a distinguished road
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 GIDBlogToyota - 2009 May Promotion by Nihal

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

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

All times are GMT -6. The time now is 03:02.


vBulletin, Copyright © 2000 - 2009, Jelsoft Enterprises Ltd.