I was just asking myself the same question.
This is what i googled:
http://moinne.com/blog/ronald/mysql/manage-hierarchical-data-with-mysql-stored-procedures
It works with stored procedures.
But so much logic in the DB is not a good thing in my opinion..