I have the following table structure:

So, each forum has a parent, which also has a parent (except for root messages), etc. I need the total number of children to be onumpost, including his children, children, children of grandchildren, etc.
Now I have a simple choice that returns immediate children:
select count(*) as child_count from forumposts where parent_forum_post_id = $criteria.fid
I'm not even sure if this is doable via sql, but I'm starting in SQL, so I thought maybe someone could give some ideas.
Any help is appreciated. Thanks.
source share