I have a simple MySQL table thats contains a list of categories, level is determined by parent_id:
id name parent_id --------------------------- 1 Home
I think, there's no easy way to do that, using one query.
I would recommend to take a look at Nested Sets, that seems to fit your needs.