On 22-Dec-2004 Michael J. Pawlowsky wrote:
Im trying to come up with a more efficient method to do this.
I have a table where people enter some info into the table.
snip
I would like to allow the users to be able to see where they stand
rank
wise with everyone else.
Right now I
Im trying to come up with a more efficient method to do this.
I have a table where people enter some info into the table.
The more entries they add the more points they get.
(1 point per entry).
I would like to allow the users to be able to see where they stand rank
wise with everyone else.
Right
Try this:
CREATE TEMPORARY TABLE tmpRankings (
Rank int auto_increment,
entries int,
user_id int
)
INSERT tmpRankings (points, user_id)
SELECT count(1), user_id
FROM sometablenamehere
GROUP BY user_id
ORDER BY entries DESC;
This way the tmpRankings table contains an