| Writing Hierarchical data into another table [message #389292]
||Sat, 28 February 2009 03:03
Registered: February 2009
I need some help regarding a problem I am currently facing.
There are two tables.
in one table hierarchical data is there in parent & child mode.
e.g A1 B1
In another table transaction data is there
e.g A1 CC 200
C1 XX 500
C4 YY 600
now my requirement is to write all missing transaction data.
The data in above tables can be written as below:
while walking from top level (say A1) to the bottom one (C5)
I have to replicate the missing node value with the immidate top value.E.g. value of A1 is 200 but the value at node B1 is missing.So it should fill the node value by 200.As there is a value at C1 node overwritting of value(here its 200) should be stopped.
At C1 value is 500,but the immidate nodes (e.g. C2 & C3) has no value.so it should be over written by 500 and it should stop at C4.Again by applying the same logic,the value at node C5 should be written as 600.
So I have write a query/procedure to insert the missing hierarchical data with missing node values.
It should look like this
So the task is to write all the missing hierarchical data
into a third table.
Please let me know if any further clarification is required.