Hi,
I am facing a problem in sorting subtree in SQL, I have a table containing the following fields:
PartnerID
Partner_ParentID
PartnerName
left
right
Depth
I want to sort only the subtree on the basis of "PartnerName" and rest tree on the basis of "left".
For Example
( assume it is sorted on the basis of "left" field.)
Mac
-->Peeter
-->Harry
-->Tison
---->Methew
---->Andrew
------->Hudson
------->Ira
---->David
-->Alisa
It should be sort on following order if i want to sort particular subtree of "Tison":
Mac
-->Peeter (sorted on ID)
-->Harry (sorted on ID)
-->Tison (sorted on ID)
---->Andrew (sorted on name)
---->David (sorted on name)
---->Methew (sorted on name)
------->Ira (sorted on name)
------->Hudson (sorted on name)
-->Alisa (sorted on ID)
I have done this using while Loop and table, is it possible to do it using one single query (as the method to sort is recursive)?
Thanx in advance.
Kavin
I am facing a problem in sorting subtree in SQL, I have a table containing the following fields:
PartnerID
Partner_ParentID
PartnerName
left
right
Depth
I want to sort only the subtree on the basis of "PartnerName" and rest tree on the basis of "left".
For Example
( assume it is sorted on the basis of "left" field.)
Mac
-->Peeter
-->Harry
-->Tison
---->Methew
---->Andrew
------->Hudson
------->Ira
---->David
-->Alisa
It should be sort on following order if i want to sort particular subtree of "Tison":
Mac
-->Peeter (sorted on ID)
-->Harry (sorted on ID)
-->Tison (sorted on ID)
---->Andrew (sorted on name)
---->David (sorted on name)
---->Methew (sorted on name)
------->Ira (sorted on name)
------->Hudson (sorted on name)
-->Alisa (sorted on ID)
I have done this using while Loop and table, is it possible to do it using one single query (as the method to sort is recursive)?
Thanx in advance.
Kavin