acidglitter Posted December 30, 2007 Share Posted December 30, 2007 i have a members table, and i want to order it by points, and then show each persons ranking. like.. 1. bob (10 points) 2. dole (6 points) 3. george (3 points) 4. joe (2 points) how could i show that george is in 3rd place without showing any other members? Link to comment https://forums.phpfreaks.com/topic/83747-rankings/ Share on other sites More sharing options...
Barand Posted December 30, 2007 Share Posted December 30, 2007 A person's ranking is the (number of people with more points) + 1 Link to comment https://forums.phpfreaks.com/topic/83747-rankings/#findComment-426102 Share on other sites More sharing options...
cooldude832 Posted December 30, 2007 Share Posted December 30, 2007 how the table is ordered in storage is irrelavent, but what you want to do is in your query add an ORDER BY to the end of it. Link to comment https://forums.phpfreaks.com/topic/83747-rankings/#findComment-426103 Share on other sites More sharing options...
Barand Posted December 30, 2007 Share Posted December 30, 2007 SELECT m.name, m.points, (SELECT COUNT(*)+1 FROM members WHERE points > m.points) as rank FROM members m WHERE name='George' Link to comment https://forums.phpfreaks.com/topic/83747-rankings/#findComment-426107 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.