Has anyone come up with a good algorithmn for converting the adjacency model to nested sets, with the following proviso:Children for a given parent must be ordered. For example, I have the following adjency model DDL:CREATE TABLE Pages(PageID INTEGER NOT NULL,Parent INTEGER,DisplayOrder INTEGER NOT NULL)
--and heres the DML:INSERT INTO Pages (PageID,Parent,DisplayOrder)SELECT 1,NULL,1UNIONSELECT 2,1,1UNIONSELECT 3,1,2UNIONSELECT 4,1,3UNIONSELECT 5,3,2UNIONSELECT 6,3,3UNIONSELECT 7,3,1
I need records 5,6 and 7 to be built in the order determined by the DisplayOrder column - in ascending order - ie. 7,5,6.I've played with Page47's and Celko's code but to no avail.Any ideas/pointers would be greatly appreciated.Cheers,macka.--There are only 10 types of people in the world - Those who understand binary, and those who don't.