title: how to update by the closest numeric value
body: <p>I have two tables  Cities_no_iata   this table have columns (CountryID,iata_code,latitude,longtiute)</p>
  
  <p>Cities_iata this table have columns (CountryID,iata_code,latitude,longtiute)</p>
  
  <p>The first table contains the cities which haven’t iata_code so all rows in iata_code column is null</p>
  
  <p>The second table contains the cities which have iata_code </p>
  
  <p>So I want to copy the closest city iata_code to the city which haven't  iata_code ,I think to do this by 2 things</p>
  
  <p><strong>1-    The closest (latitude and longitude) for the two cities</strong> </p>
  
  <p><strong>2-    The same CountryID for the the two cities .</strong></p>
  
  <pre><code>Update Cities_iata
  JOIN Cities_no_iata USING (CountryID)
  Where ABS( cities_iata.latitude)= ABS(Cities_no_iata.latitude)
  AND  ABS( cities_iata.longitude)= ABS(Cities_no_iata.longitude)
  AND cities_iata.CountryID = Cities_no_iata.country_id
  set(   Cities_no_iata.iata_code =cities_iata.iata_code);
  </code></pre>
  
  <p>but dont work </p>