Y
Y
YourQuestion2015-04-07 15:42:39
MySQL
YourQuestion, 2015-04-07 15:42:39

Geonames.org How do I get the area for a country (eg Russia) and the city for that area?

Good afternoon.
We make a simple query and get several cities:

SELECT * FROM `allCountries` WHERE name='Moscow' and `country_code` = 'RU'

aKcVrC2.png
For some cities, we generally get 4-5 results.
Tell me how to choose the right region / region for the country and then get the cities for this region?
Addition: we can get the region, but how to get the list of cities for the region?
PS: please be careful, you are not interested in the geonames.org API, but in getting information from the database.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
B
boomwest, 2015-04-16
@boomwest

If I understand correctly, then you need DISTINCT to select not 5 cities in Moscow, but one.
Get city area? DISTINCT "region" JOIN 'cities' ON region.id=cities.id

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question