Ok this is a pretty dumb question.. I want to find the position of an entry in a database filled with scores so that I can say. "This player is ranked 13 out of 108" I can use "COUNT *" to retrieve the 108 but what is the sql command to retrieve the 13? Thanks!
Something like: select * from players order by rank desc limit 13, 1 Would bring back the player ranked 13th assuming there is a rank column
Thanks for your reply. I don't have a rank column. Here's a simple example of my table: player __ score _ 1 _____ 10 _ 2 _____ 4 _ 3 _____ 3 _ 4 _____ 15 + what I want to do is find what position a specific player is in. ie. player 2 is 3rd. Any ideas how I can do that?
If you know player's score (you can select it before anyway) - use a query like that SELECT count(*) FROM players WHERE score >=4 Code (markup): where 4 is score of 2nd player It will give you quantity of players having score more that your player - and so it will be the place
What about this? SELECT count(*)+1 AS rank FROM _TABLE_ as t1, _TABLE_ as t2 WHERE t1.player = "Player Name" AND t1.score > t2.score