Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
fl0at
Starting Member
5 Posts |
Posted - 2004-08-19 : 03:22:19
|
| Having a table like this did pid name haschild1 0 Parent 02 1 Sub1 03 2 Sub2 15 1 Suba1 016 3 Suba2 1I need to get this result if did = 1 count the subs and get the deepest did having haschild = 1And there can be more more deep in these subbing.How can i find the given the subs of given did ? Suppose when u reach subbest level there is haschild 1 Shall i use cursor or while loop ? Any Ideas..? |
|
|
samsekar
Constraint Violating Yak Guru
437 Posts |
Posted - 2004-08-19 : 04:07:39
|
| Can you please post the expected results?- Sekar |
 |
|
|
fl0at
Starting Member
5 Posts |
Posted - 2004-08-19 : 05:21:44
|
quote: Originally posted by samsekar Can you please post the expected results?- Sekar
Ok . Here is what i have in my When i give a did to a stored proc it will make a list of all dids those haschilds are 1 and which all belong to main of that did. Like Suppose i have these in table did pid haschild1 0 02 1 03 2 14 1 19 3 112 2 113 12 116 13 1Need this result when i ask did = 2 did pid haschild 3 2 19 3 112 2 1 13 12 116 13 1 |
 |
|
|
|
|
|