<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
	<channel>
		<title><![CDATA[Latest posts for the topic "Collection of geonames SQL queries"]]></title>
		<link>http://forum.geonames.org/gforum/posts/list/4.page</link>
		<description><![CDATA[Latest messages posted in the topic "Collection of geonames SQL queries"]]></description>
		<generator>JForum - http://www.jforum.net</generator>
			<item>
				<title>Collection of geonames SQL queries</title>
				<description><![CDATA[ This thread is here to collect helpful/useful queries on a local geonames database. Please specify the query in the following order:

Subject: <b>Description</b>

<u>Database Engine</u>
Query

<u>Database Engine</u>
Query

Do not ask any questions here, this thread exists to reduce your time looking around the forum for queries. If you require support, please create a new thread. :)]]></description>
				<guid isPermaLink="true">http://forum.geonames.org/gforum/posts/list/2033.page#8242</guid>
				<link>http://forum.geonames.org/gforum/posts/list/2033.page#8242</link>
				<pubDate><![CDATA[Sun, 15 Aug 2010 13:59:04]]> GMT</pubDate>
				<author><![CDATA[ a110y]]></author>
			</item>
			<item>
				<title>Geonames import script</title>
				<description><![CDATA[ <u>MySQL:</u>

Follow download instructions here: http://forum.geonames.org/gforum/posts/list/732.page

And then import using the following script.

UPDATE: 2010-08-15
]]></description>
				<guid isPermaLink="true">http://forum.geonames.org/gforum/posts/list/2033.page#8243</guid>
				<link>http://forum.geonames.org/gforum/posts/list/2033.page#8243</link>
				<pubDate><![CDATA[Sun, 15 Aug 2010 14:04:48]]> GMT</pubDate>
				<author><![CDATA[ a110y]]></author>
			</item>
			<item>
				<title>Re:Collection of geonames SQL queries</title>
				<description><![CDATA[ Postgres 8.4 or higher

Starting with a particular GeoNames id (in this case 6429727) get its name and the name and id of each place containing it all the way up the hierarchy:

<span class="genmed"><b>Code:</b></span><br>
		<div style="overflow: auto; width: 100%;">
		<pre>
WITH RECURSIVE geonametree AS

&#40;SELECT geoname.geonameid AS id, geoname.name AS name, hierarchy.parentid AS parent, hierarchy.childid AS child
FROM hierarchy
	JOIN geoname ON geoname.geonameid = hierarchy.childid 
	WHERE geoname.geonameid = 6429727

UNION ALL

SELECT geoname.geonameid AS id, geoname.name AS name, hi.parentid AS parent, hi.childid AS child
FROM hierarchy AS hi
	JOIN geoname ON geoname.geonameid = hi.parentid 
	INNER JOIN geonametree AS gt ON &#40;hi.childid = gt.parent&#41;
&#41;
SELECT id, name, parent, child
FROM geonametree;
</pre>
		</div>]]></description>
				<guid isPermaLink="true">http://forum.geonames.org/gforum/posts/list/2033.page#12775</guid>
				<link>http://forum.geonames.org/gforum/posts/list/2033.page#12775</link>
				<pubDate><![CDATA[Thu, 19 Sep 2013 07:23:24]]> GMT</pubDate>
				<author><![CDATA[ jcreel256]]></author>
			</item>
			<item>
				<title>Re:Collection of geonames SQL queries</title>
				<description><![CDATA[ That totally depends on what you want with the data, and what exactly you want to query. Have you taken a look at the readme.txt?]]></description>
				<guid isPermaLink="true">http://forum.geonames.org/gforum/posts/list/2033.page#45097</guid>
				<link>http://forum.geonames.org/gforum/posts/list/2033.page#45097</link>
				<pubDate><![CDATA[Thu, 24 May 2018 10:22:42]]> GMT</pubDate>
				<author><![CDATA[ Oliver91]]></author>
			</item>
			<item>
				<title>Re:Collection of geonames SQL queries</title>
				<description><![CDATA[ SELECT 
    a.fclasscode, COUNT(a.geonameid) AS NbGeoNamesId, b.name
FROM
    geo_01cities1000 AS a INNER JOIN geo_featurecodes AS b ON a.fclasscode = b.code
GROUP BY a.fclasscode
ORDER BY NbGeoNamesId DESC
LIMIT 0,10;]]></description>
				<guid isPermaLink="true">http://forum.geonames.org/gforum/posts/list/2033.page#45728</guid>
				<link>http://forum.geonames.org/gforum/posts/list/2033.page#45728</link>
				<pubDate><![CDATA[Tue, 19 Feb 2019 11:05:01]]> GMT</pubDate>
				<author><![CDATA[ AlexandraHudson]]></author>
			</item>
	</channel>
</rss>