sureshk 23318 (10/16/2012)
i have a table likeTID PID DSC
1 0 Parent1
2 1 Child1
3 1 Child2
4 1 Child3
5 0 ParentA
6 5 ChildA
7 5 ChildB
That's what's known as an "Adjacency List". They usually hold a hierarchical tree of data. An "Adjacency List" is very easy for even humans to maintain but are seriously performance challenged when it comes to processing. If it were me, I'd build a Nested Sets structure into this table for the best of both worlds.
It would appear that you're either missing the very top level or you don't mind working with multiple trees known as a "forest". The problem with the missing the top level is that you can't actually have any DRI between the PID and the TID column.
I also agree with the previous post... what is the actual querstion here?
--Jeff Moden
Change is inevitable... Change for the better is not.