PDA

View Full Version : query to get number of forums in category?


wtrk
05-24-2009, 05:48 PM
how can i automatically count the number of forums in a category?

Cryo
05-24-2009, 05:52 PM
SELECT
count(forumid) AS forums
FROM
forum
WHERE
parentid = 5

Replace the "5" in parentid with the ID of the forum that is serving as the category. You'll need to add a prefix in front of "forum" if you have your vB installed using one.

wtrk
05-24-2009, 06:16 PM
thanks

Dismounted
05-25-2009, 05:53 AM
Note that the query will not count sub-forums. Also, you are probably better off using data from the datastore (although this is a little more advanced).