March 23, 2010 at 6:51 am
Following Shows my table stucture.I need to find who is eligible for grand children.
ID NAME ParentID
1 First NULL
2 Second NULL
3 First101 1
4 First102 1
5 First201 3
6 First202 4
7 Second101 2
8 Second201 7
9 first301 5
Expected Result
ID Level(this is No of level not children)
1 3
2 2
3 2
4 1
5 1
6 0
7 1
8 0
Is it possible get the result without using cursors
Thanks in advance
March 23, 2010 at 6:55 am
Thiyagu-343189 (3/23/2010)
Following Shows my table stucture.I need to find who is eligible for grand children.
That is not a table structure, it is just a bunch of text. If you have a real table structure, please post its definition. Include INSERT statements to populate the table. Explain your requirements and the rules clearly. Also show what you have tried so far, or include your thoughts or plan of attack. I am happy to help, but I will not do everything for you.
In particular, please explain what you mean by grand-children. Is this related to a family tree? 😉
Paul White
SQLPerformance.com
SQLkiwi blog
@SQL_Kiwi
March 23, 2010 at 7:22 am
Paul
I have found the solution
thanks for ur comments.
I hope u do know family relationship.
March 23, 2010 at 7:33 am
Glad to hear it.
Paul White
SQLPerformance.com
SQLkiwi blog
@SQL_Kiwi
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply