Re: Modified Preorder Tree Traversal - Advanced question
Here is the SQL to make the test data:
CREATE TABLE `regions` (
`region_id` int(10) NOT NULL auto_increment,
`name` text NOT NULL,
`lft` int(10) default NULL,
`rgt` int(10) default NULL,
`zoom` int(2) NOT NULL default '17',
PRIMARY KEY (`region_id`)
) ENGINE=MyISAM;
INSERT INTO `regions` VALUES (1, 'Root', 1, 20, 15);
INSERT INTO `regions` VALUES (2, 'UK', 2, 9, 5);
INSERT INTO `regions` VALUES (3, 'Scotland', 3, 4, 3);
INSERT INTO `regions` VALUES (4, 'England', 5, 8, 4);
INSERT INTO `regions` VALUES (5, 'Surrey', 6, 7, 1);
INSERT INTO `regions` VALUES (6, 'US', 10, 19, 7);
INSERT INTO `regions` VALUES (7, 'Texas', 11, 14, 6);
INSERT INTO `regions` VALUES (8, 'Dallas', 12, 13, 4);
INSERT INTO `regions` VALUES (9, 'Connecticut', 15, 18, 3);
INSERT INTO `regions` VALUES (10, 'Hartford', 16, 17, 2);