Quote Originally Posted by prophet0 View Post
My query is as follows
...
if you have any way of improving it please feel free to direct me in the correct path
You may find this useful for storing a tree in an SQL database.