If anyone can help i am the most happiest person in world

  • 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

  • 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/

  • 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.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • May be the post should read like:

    Have I table like a:.... ?

    :hehe:

    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!":-D
    (So many miracle inventions provided by MS to us...)

    How to post your question to get the best and quick help[/url]

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply