PDA

View Full Version : Query to show top posters in specific forums


glennybee
02-15-2013, 05:23 PM
Hi folks,

I'm trying to find out who are the top posters in the individual sections on my forum. I've been given this query but it returns 0 results. I'm not using a table prefix for the database. I'm running vb 3.8.7.


SELECT COUNT(postid) AS count, user.username
FROM post
LEFT JOIN user ON (user.userid = post.userid)
LEFT JOIN thread ON (thread.threadid = post.threadid)
WHERE thread.forumid = 108
GROUP BY post.username
ORDER BY count
DESC


I've attached a screen shot of the query.

Thanks for any advice or if there's a mod that I can use, that'd be great.

Thanks
Glen

Lynne
02-15-2013, 05:45 PM
The query worked just fine on my test site (I changed the thread.forumid, of course). Perhaps the thread.forumid is incorrect?

glennybee
02-15-2013, 05:57 PM
Thanks very much Lynne, I was using the parent forum id thinking that would cover all child forums but obviously doesn't and now I think about it, its obvious that it won't lol.

Sometimes it's the simplest things that baffle us. :)