Let\'s say you have the following table:
items(item_id, item_parent)
... and it is a self-referencing table - item_parent r
I need to find a solution for the same task, found some articles, but still didn't choose which way to go...
http://explainextended.com/2009/07/20/hierarchical-data-in-mysql-parents-and-children-in-one-query/
May be these links might help you. If you find a good solution - please post it here. i'm not allowed to post more then 1 link - i will add some to next posts