Jump to content

Archived

This topic is now archived and is closed to further replies.

Maverickb7

counting something

Recommended Posts

I was wondering if someone could help me with something. I have a table in my database and within one of the columns is the user id of whom ever created the row. Now what I would like to do is display the top x posters. So I need to somehow count how many times each user id is listed then display the top x users. Does anyone know how I would go about doing this?

Share this post


Link to post
Share on other sites
SELECT username, count( * ) AS blah FROM tablename GROUP BY username ORDER BY blah DESC LIMIT 10

you might have to play with that a bit but that should get you going.

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.