MySQL select top rows with same condition values
问题 I don't know how to title this problem. Correct me if you have better words. I have two tables, Users and Posts. Users: id | username | password | ... Posts: id | author_id | title | content | ... Now I want to list the "most active" users - the users who have written the most posts. And specifically, I want the top 10 result. SELECT u.username, COUNT(p.id) AS count FROM Posts p, Users u WHERE u.id=p.author_id GROUP BY p.author_id ORDER BY count DESC LIMIT 10; I can get the expected result.