I have a script that i need to find out the top posters.
I need to somehow find a way to select the highest amount of posts. Its really hard to explain, i have the table set up with a field called "dsub", i need to know how to select the most common user id in that field. If you know how to do this, please let me know.
http://www.newbie-developer.com - Newbie web-developer community.






Peter J. Boettcher posted this at 20:40 — 30th July 2002.
They have: 812 posts
Joined: Feb 2000
Try this:
SELECT TOP 5 dsub
FROM MyUserTable
GROUP BY dsub
ORDER BY COUNT(dsub) DESC
That will return the top 5 user ids. You'll have to modify it to work with your database tables and fields.
PJ | Are we there yet?
pjboettcher.com
Mark Hensler posted this at 22:35 — 30th July 2002.
He has: 4,044 posts
Joined: Aug 2000
and for mySQL:
SELECT dsub
FROM MyUserTable
GROUP BY dsub
ORDER BY COUNT(dsub) DESC
LIMIT 5