Hello and welcome to our community! Is this your first visit?
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 1 of 1
  1. #1
    Senior Coder
    Join Date
    Aug 2005
    Thanked 1 Time in 1 Post

    forum -> topics->posts count

    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?
    Last edited by thesavior; 04-07-2007 at 08:06 AM.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts