Possible Duplicate:
Hierarchical SQL question
I have below records to maintain. It has parent child relation. I have one table and from that table i am going to build dynamic menu…So it has below type of records. Like a tree..One parent has two sub menu and two sub menu contains two or three menu…So how to manage it by inline query?
Here is my table structure
***ColumnName***
ID
MenuName
ParentID
URL
This will be data
ID ParentID
1 0
2 0
3 0
4 0
5 1
6 1
7 5
8 5
9 2
How to create select query to get parent child relation?? if anyone have any idea about this than please help me.
may be this