View Full Version : forum -> topics->posts count

04-07-2007, 07:38 AM
okay, so in my "posts" table i have a col called "topicid". In the topic table, there are two cols, one called "id" that matches "topicid" from the posts forum, and "forumid". I want to be able to count all posts there are in a specific forum. What would the sql query before that?

Im thinking it would be:

SELECT count(p.id) FROM posts AS p INNER JOIN topics AS t on p.topicid=t.id INNER JOIN forums AS f on t.forumid=f.id WHERE f.id = 1

any disagreements?