diff --git a/lib/geocoder/lookups/maxmind_local.rb b/lib/geocoder/lookups/maxmind_local.rb index c6fa4a06928c0bec327da2fbabdedc79d3cd9be7..059a19e6e8d82e68023aaba1a5031db902adce02 100644 --- a/lib/geocoder/lookups/maxmind_local.rb +++ b/lib/geocoder/lookups/maxmind_local.rb @@ -36,7 +36,7 @@ module Geocoder::Lookup addr = IPAddr.new(query.text).to_i q = "SELECT l.country, l.region, l.city, l.latitude, l.longitude FROM maxmind_geolite_city_location l WHERE l.loc_id = (SELECT b.loc_id FROM maxmind_geolite_city_blocks b - WHERE b.start_ip_num <= #{addr} AND #{addr} <= b.end_ip_num)" + WHERE b.start_ip_num <= #{addr} AND #{addr} <= b.end_ip_num LIMIT 1)" format_result(q, [:country_name, :region_name, :city_name, :latitude, :longitude]) elsif configuration[:package] == :country addr = IPAddr.new(query.text).to_i