Need Help on Query!!!!!!

Ravinder Rao Machadi

Need Help on Query!!!!!!
Hi Studds,

We have the situation over here in one of our development
team.
we have an Organisation & Organisation_hierarchy tables.
In Organisation_hierarchy table we are maintaing a
hierarchy of 15 organisations with level no.s

The hirarchy table is populated as follows...

ORG_ODE Level H1 H2 H3 H4 H5 H6..
------------------------------------------------------------
Mk-1 1 Mk-1
Mk-2 2 Mk-1
Mk-3 3 Mk-2 Mk-1
Mk-4 4 Mk-3 Mk-2 Mk-1
Mk-5 5 Mk-4 Mk-3 Mk-2 Mk-1
Mk-6 6 Mk-5 Mk-4 Mk-3 Mk-2 Mk-1
Mk-7 7 Mk-6 Mk-5 Mk-4 Mk-3 Mk-2 Mk-1
-
-
-
For example in the above table the Mk-5 ‘s higher
organization is changed from Mk-4 to Mk-3 then the
Changes will be reflected in Other organizations whose
higher organization is MK-5 reflections on the other values
of higher organizations and levels are as shown below.

ORG_ODE Level H1 H2 H3 H4 H5 H6..
------------------------------------------------------------
Mk-1 1 Mk-1

Mk-2 2 Mk-1
Mk-3 3 Mk-2 Mk-1
Mk-4 3 Mk-2 Mk-1
Mk-5 3 Mk-3 Mk-2 Mk-1
Mk-6 4 Mk-5 Mk-3 Mk-2 Mk-1
Mk-7 5 Mk-6 Mk-5 Mk-3 Mk-2 Mk-1
Mk-8 6 Mk-7 Mk-6 Mk-5 Mk-3 Mk-2 Mk-1
-
this is the situation. We are not able to write a efficient
query to perform the entire updation. If any one of you
have the alternative solution, please send it accross.


Thanks in advance...

Regards,

Machadi




=====
Thanks & Regards,

Ravinder Rao Machadi
+91 (0)98310 80418(cell)

__________________________________________________
Do You Yahoo!?
Yahoo! Photos - Share your holiday photos online!
http://photos.yahoo.com/