Originally Posted by xpi0t0s View Post
I don't know if a query can be constructed that will return the results you want.

It's a fairly easy problem to solve using some kind of procedural solution; for each node, work out the number of children, recursively (or iteratively) until you have a final solution: 102 (say) has 2 plus the number of children 104 and 105 have; 104 has 2+(107 and 108's children), and so on until all outstanding "N's children" have been resolved.
Thanks for the response. We tried that, but when it is done in real time, the system crashes after it reaches 15 levels.

So we wanted to find a way where instead of real-time if a procedure can be run in the background, or a cron every night that would go through the member list and generate the total node count for each member. We played with sql procedures, but are wondering if perl would be better performance-wise if going through a list of 1000 or more members.