Mathimatical Select Statement.

  • HI ,,

    i have two different Tables, One is used to store data, and second is used to show the relationship that the data is stored in the first table...

    TABLE1

    DocID Email Qty_Atch Attch_Doc

    1 A 0 0

    2 B 1 B1

    Now Attachement should have DocID So

    3 B1 0 0

    4 C 3 C1,C2,C3

    Now Attachement should have DocID So

    5 C1 1 C12

    Now Attachement should have DocID So

    6 C12 0 0

    7 C2 0 0

    8 C3 0 0

    in second table i have saved the relationship which is parent and which is child .. like this

    ParentDocID ChildDocID

    2 3

    4 5

    5 6

    4 7

    4 8

    what i need is to save the DocID into another table in such a formate that if the documents are interrelated to each other should get single ID.. like this by a Store procedures..

    Newly_DocID DocID

    1 1

    2 2

    2 3

    3 4

    3 5

    3 6

    3 7

    3 8

  • That's what is called "expanding a hierarchy". Microsoft has posted an example on how to do just that. It's here:

    http://msdn2.microsoft.com/en-us/library/aa172799(SQL.80).aspx

    ----------------------------------------------------------------------------------
    Your lack of planning does not constitute an emergency on my part...unless you're my manager...or a director and above...or a really loud-spoken end-user..All right - what was my emergency again?

Viewing 2 posts - 1 through 1 (of 1 total)

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