I have the following table structure:
So each forum post has a parent, who also has a parent(except the root posts), etc.
What I need is to get the total number of children a forumpost has, including his children's children, grandchildren's children and so on.
For now I have a simple select that returns the immediate children:
select count(*) as child_count
from forumposts
where parent_forum_post_id = $criteria.fid
I'm not even sure this is doable via sql, but I'm a begginer in SQL so I thought maybe someone can give some ideas.
Any help is appreciated. Thanks.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…