I am making a forum for my school project and on my home page I want to make some kind of a leaderboard where you can see the top 10 posters + how much they have postet. Ill add a picture of my data base so if you maybe know how it would work please let me know. Database
I don't know what you mean, but if you mean the database query, it can be something like this:
SELECT username,
COUNT(*) AS total_post
FROM your_table
GROUP BY username
ORDER BY COUNT(*) DESC
LIMIT 10
I assume your table name posts. You can replace it by your table name.
SELECT COUNT(post) as total_post, username FROM posts GROUP BY username;
It will return something like
total_post username
5 username
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.