hi guys I have a custom forum i have a users table which has userid userstable ----------------- userid , name 1 , 'hhh' 2 , 'hhhj' 3 , 'mmm' in another table forumpost ------------------- userid , forumcontent 1 , 'xyz' 1, 'ddd' 2, 'ff' 1, 'jj' i want a query which will return the top users who posted the most content is there any query like that which return that
Try this: SELECT userid, COUNT(*) AS hits FROM `forumpost` GROUP BY userid ORDER BY hits DESC Code (markup):