Wow! Amazing! Your solution deserves a more prominent place than being buried in the chronological heap of the forum archive. Just one observation - I'd substitute <i>order by 5</i> by <i>order by pathDistance</i> (never liked ordinal reference to column names!). Thank you.