+--------+---------+-----------+ | id | title | parent_id | +--------+---------+-----------+ | 1 | Lvl-1 | null | +--------+---------+-----------+
I wrote a post in the DBA StackExchange (October 24, 2011) on how to pull this off using Stored Procedure programming. I also included some sample data and the results.