Hello you all!!!

I've got a tricky issue that I want to discuss with you. Currently I'm
developing a Quiz Game and I'm using MySQL to host data. In a Quiz Game that
is going to have prizes the ranking of a user is very important and I want
to find a good way of creating one.
To make it simple let's suppose my table looks like this:
nick VARCHAR(12) NOT NULL
mpoints INT NOT NULL
Where nick is the name of the user and mpoints is the amount of points the
user has scored on a certain month.
As you can imagine, on a Quiz Game ranking positions change a lot and I
cannot just add a field to put the ranking position because then I would
have to update the entire table (more than 5.000 users) everytime positions
change.
My idea is to create a kind of count column to instantly know the position
of the player. Something like this:

nick    mpoints     ranking
A        3234        1
B        3121        2
C        2976        3
D        2123        4
...
...
...

How can I generate a query that creates this temp column (ranking)
reflecting the current position of the users? I thought about using COUNT()
but this must be used with GROUP BY and will not really reveal the current
ranking position of the user. The idea is to create a result set that is
able to tell using descending order exactly in which position the player is.
Is it possible to create a column like the one I have just described? If not
what else can I do to solve my problem? I guess it must be not difficult to
create this column but I just can't figure out how to do it!
Help would be very much appreciated!

Best regards,

Fábio Ottolini

P.S.: Queries are going to be sent either via PHP (webpage) or C (game
server). PHP is most needed right now and I really can't program in C... I'm
going to pass the general idea to a friend of mine.



---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to