I got this query that gets the position of the playing based on his time (the person with the smallest time is in the first position): SELECT COUNT( * ) AS position FROM ( SELECT * FROM ( SELECT * FROM game ORDER BY time )g WHERE time < ( SELECT time FROM game WHERE uid =2 ORDER BY time LIMIT 1 ) GROUP BY uid )rank Code (markup): What if I want to go through the list of all users and display their positions.... how would I do that...??
SELECT * FROM game ORDER BY time ASC; The above will list everyone in the game, from the top time to the bottom. Now to show there position, just add a loop that as each row of data is written it incraments a counter and this is your player position. Example: i = i + 1
Thanks for the quick reply, but the problem is that I have several entries for each user (an entry for every time) and I want to get positions of a set of like 50 specific users out of everyone
again thanks for the quick reply, but I need to get a subset of like 50 users (I have their uids) with their positions compared to everyone else (not just to themselves)
Thats tricky stuff, you would have to give out alot more information that what you have already. Is the UIDs 1 - 50 or random? To only have 50 records returned use LIMIT(0,50) or SELECT TOP(50) FROM....