• Try looking at recursive CTE or adjacency model to start. There's plenty of good articles on SSC on what you want to do.

    [Edit]

    Oops yeah that works. Didn't read the req. clearly, I thought you wanted to append the values like a string. Summing it is a lot easier... 🙂

    ---------------------------------------------------------------
    Mike Hahn - MCSomething someday:-)
    Right way to ask for help!!
    http://www.sqlservercentral.com/articles/Best+Practices/61537/
    I post so I can see my avatar :hehe:
    I want a personal webpage 😎
    I want to win the lotto 😀
    I want a gf like Tiffa :w00t: Oh wait I'm married!:-D