Dear Oracle Pros,
I need a help with a query where you pass a value from parent to child, but only if the child has no value of his. I am trying to go from value column to end_result column:
Sample |
---|
with x as (select 1 as id ,null as parent ,1 as value ,1 as end_result from dual union select 2 ,1 ,0 ,0 from dual union select 3 ,1 ,null ,1 from dual union select 4 ,2 ,0 ,0 from dual union select 5 ,2 ,1 ,1 from dual union select 6 ,2 ,null ,0 from dual union select 7 ,3 ,null ,1 from dual union select 8 ,3 ,null ,1 from dual union select 9 ,3 ,null ,1 from dual) select x.* from x order by id, parent; |