SQL: Select SUM of all children records recursively
This may be some some assistance: http://mikehillyer.com/articles/managing-hierarchical-data-in-mysql/
This would be a simple query in Oracle ( http://download-east.oracle.com/docs/cd/B12037_01/server.101/b10759/queries003.htm) since it supports hierarchical queries using "CONNECT BY" but I don't think there's a comparable solution for MySQL. It looks like you're going to do something really inefficient or you're going to have to modify your table structure to support this specific function.