jasonc Posted December 23, 2007 Share Posted December 23, 2007 I have created my own forum but wish to have a top ten list of members who have posted the most on my home page. i have a field called 'username' which i want to count and then work out which member shows the most and then have it shown first then each in turn to the one who has posted the least till i have either all members shown if less then ten or just the first ten. can this be done using mysql coding or would i have to use the 'username' from the members signup database table and find each member in turn and count the number of posts made and then sort this list to get the list i need? thanks in advance for your help Quote Link to comment https://forums.phpfreaks.com/topic/82950-solved-trying-to-create-a-top-ten-members-list-who-have-posted-the-most/ Share on other sites More sharing options...
Barand Posted December 23, 2007 Share Posted December 23, 2007 Something like SELECT username, COUNT(*) as postcount FROM posts GROUP BY username ORDER BY postcount DESC LIMIT 10 Quote Link to comment https://forums.phpfreaks.com/topic/82950-solved-trying-to-create-a-top-ten-members-list-who-have-posted-the-most/#findComment-421882 Share on other sites More sharing options...
jasonc Posted December 23, 2007 Author Share Posted December 23, 2007 wow that easy thank you very much for your help. merry xmas. Quote Link to comment https://forums.phpfreaks.com/topic/82950-solved-trying-to-create-a-top-ten-members-list-who-have-posted-the-most/#findComment-421907 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.