From 86a8900e21f86f01524284ecae76117ed5a91637 Mon Sep 17 00:00:00 2001 From: Sarah Hoffmann Date: Fri, 18 Aug 2017 23:07:53 +0200 Subject: [PATCH] fix subqueries when getting details for postcodes --- lib/Geocode.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/Geocode.php b/lib/Geocode.php index 01abc43c..7d899b0e 100644 --- a/lib/Geocode.php +++ b/lib/Geocode.php @@ -499,7 +499,7 @@ class Geocode $sSQL .= "UNION "; $sSQL .= "SELECT"; $sSQL .= " 'P' as osm_type,"; - $sSQL .= " (SELECT osm_id from placex p WHERE p.place_id = parent_place_id) as osm_id,"; + $sSQL .= " (SELECT osm_id from placex p WHERE p.place_id = lp.parent_place_id) as osm_id,"; $sSQL .= " 'place' as class, 'postcode' as type,"; $sSQL .= " null as admin_level, rank_search, rank_address,"; $sSQL .= " place_id, parent_place_id, country_code,"; @@ -515,13 +515,13 @@ class Geocode $sSQL .= " FROM "; $sSQL .= " place_addressline s, "; $sSQL .= " placex p"; - $sSQL .= " WHERE s.place_id = parent_place_id"; + $sSQL .= " WHERE s.place_id = lp.parent_place_id"; $sSQL .= " AND p.place_id = s.address_place_id "; $sSQL .= " AND s.isaddress"; $sSQL .= " AND p.importance is not null"; $sSQL .= " ) AS addressimportance, "; $sSQL .= " null AS extra_place "; - $sSQL .= "FROM location_postcode"; + $sSQL .= "FROM location_postcode lp"; $sSQL .= " WHERE place_id in ($sPlaceIDs) "; if (30 >= $this->iMinAddressRank && 30 <= $this->iMaxAddressRank) { -- 2.39.5