MySQL Forums
Forum List  »  General

Modified Preorder Tree Traversal - Advanced question
Posted by: Clive Galway
Date: August 23, 2005 02:06PM

I am encoding a Region (ie Country/State/County) tree for a mapping project I am doing using Google Maps.

Given this Basic MPTT Tree...

Region......lft...rgt...zoom
UK...........1.....8......5
Scotland...2.....3......3
England....4.....7......3
Surrey......5.....6......1

Visual Representation (zoom in brackets):
................UK(5)...................
..Scotland(3)....England(3)......
.......................Surrey(1).......

zoom is a figure representing the level of "zoom" of a map that a region and the things in it are visible.

I wish to run a query to pull leaf nodes.

Normally this would be a simple case of return all entries where lft=rgt-1

This would return Scotland and Surrey.

However, say I wish to specify that I only want to return entries down to a minimum of zoom 3.

ie the result I am looking for it to return given a zoom of 3 is Scotland and England. I want it to ignore surrey as surrey has a zoom of 1.

Does anyone know how to do this ?

Options: ReplyQuote


Subject
Written By
Posted
Modified Preorder Tree Traversal - Advanced question
August 23, 2005 02:06PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.