<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
	<channel>
		<title><![CDATA[Latest posts for the topic "Hierarchy"]]></title>
		<link>http://forum.geonames.org/gforum/posts/list/4.page</link>
		<description><![CDATA[Latest messages posted in the topic "Hierarchy"]]></description>
		<generator>JForum - http://www.jforum.net</generator>
			<item>
				<title>Hierarchy</title>
				<description><![CDATA[ Hi everybody,

First of all: thanks for a great and well done work.

I have a little doubt. I downloaded your dump files in order import them to a database.

I've been trying to figure out how could I do some &quot;standard&quot; actions regarding geographical information, just like:
 -&quot;Where am I placed?&quot;
 -&quot;Who are my children?&quot;
 -etc.

I got stuck when trying to get the query that gives my the &quot;whole path of my parents&quot;.

While I achieved to get all childrens of a geoname id with something like this:

<span class="genmed"><b>Code:</b></span><br>
		<div style="overflow: auto; width: 100%;">
		<pre>SELECT     gd1.Name, gd.Name AS Expr1, gh.childId 
FROM         hierarchy gh INNER JOIN
                      GeoNames gd ON gd.GeoNameID = gh.childId INNER JOIN
                      GeoNames gd1 ON gd1.GeoNameID = gh.parentId
WHERE     &#40;gh.parentId = 3336901&#41;</pre>
		</div>

(That would return all provinces in Catalonia, Spain)

I also achieved to get the inmediate parent to a given geoname id:

<span class="genmed"><b>Code:</b></span><br>
		<div style="overflow: auto; width: 100%;">
		<pre>SELECT     gd1.Name, gd.Name AS Expr1, gh.parentId
FROM         hierarchy gh INNER JOIN
                      GeoNames gd ON gd.GeoNameID = gh.childId INNER JOIN
                      GeoNames gd1 ON gd1.GeoNameID = gh.parentId
WHERE     &#40;gh.childId = 3128759&#41;</pre>
		</div>

(That would return Catalonia, which is the inmediate parent of the Province of Barcelona)


My question is: is it possible to get all parents from Barcelona to Europe with a single query? (just as the first query I pasted but reverse). 

Just in case my english is not understable... I would like to get something like Barcelona &gt;Province of Barcelona &gt; Catalonia &gt; Spain &gt; Europe. All in a single query not recursively querying.

Any help would be kindly appreciated.


Once again thanks for all the work!]]></description>
				<guid isPermaLink="true">http://forum.geonames.org/gforum/posts/list/3798.page#11334</guid>
				<link>http://forum.geonames.org/gforum/posts/list/3798.page#11334</link>
				<pubDate><![CDATA[Thu, 15 Mar 2012 06:06:36]]> GMT</pubDate>
				<author><![CDATA[ oxalus]]></author>
			</item>
			<item>
				<title>Re:Hierarchy</title>
				<description><![CDATA[ If you have imported geonodes into a db like you did, this is a MUST read, and a good start for digging deeper:

http://mikehillyer.com/articles/managing-hierarchical-data-in-mysql/

]]></description>
				<guid isPermaLink="true">http://forum.geonames.org/gforum/posts/list/3798.page#11354</guid>
				<link>http://forum.geonames.org/gforum/posts/list/3798.page#11354</link>
				<pubDate><![CDATA[Mon, 26 Mar 2012 07:30:10]]> GMT</pubDate>
				<author><![CDATA[ tomzeppenfeldt]]></author>
			</item>
	</channel>
</rss>