Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

If anyone can help i am the most happiest person in world Expand / Collapse
Author
Message
Posted Tuesday, October 16, 2012 12:32 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Friday, November 9, 2012 3:19 AM
Points: 1, Visits: 9
i have a table like

TID PID DSC

1 0 Parent1
2 1 Child1
3 1 Child2
4 1 Child3
5 0 ParentA
6 5 ChildA
7 5 ChildB
Post #1373049
Posted Tuesday, October 16, 2012 12:51 AM


SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: Thursday, October 9, 2014 7:34 AM
Points: 2,666, Visits: 4,736
Well, nobody can help with this limited amount of information

Please describe your issue and give us some sample data and the expected results as per your sample data
It would be really good if you can provide this in a readily usable format
If you are not sure on how to do this, reading the link in my signature would give you a good idea



Kingston Dhasian

How to post data/code on a forum to get the best help - Jeff Moden
http://www.sqlservercentral.com/articles/Best+Practices/61537/
Post #1373053
Posted Tuesday, October 16, 2012 8:04 AM


SSC-Dedicated

SSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-Dedicated

Group: General Forum Members
Last Login: Yesterday @ 1:53 PM
Points: 35,366, Visits: 31,905
sureshk 23318 (10/16/2012)
i have a table like

TID 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
"RBAR is pronounced "ree-bar" and is a "Modenism" for "Row-By-Agonizing-Row".

First step towards the paradigm shift of writing Set Based code:
Stop thinking about what you want to do to a row... think, instead, of what you want to do to a column."

(play on words) "Just because you CAN do something in T-SQL, doesn't mean you SHOULDN'T." --22 Aug 2013

Helpful Links:
How to post code problems
How to post performance problems
Post #1373285
Posted Tuesday, October 16, 2012 8:18 AM
SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: 2 days ago @ 8:55 AM
Points: 2,873, Visits: 5,185
May be the post should read like:

Have I table like a:.... ?



Actually the question is in the post title:
If anyone can help? ...
The answer is: Yes, definitely someone can help!



_____________________________________________
"The only true wisdom is in knowing you know nothing"
"O skol'ko nam otkrytiy chudnyh prevnosit microsofta duh!"
(So many miracle inventions provided by MS to us...)

How to post your question to get the best and quick help
Post #1373298
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse