title: Find all nearest zip codes with lat and long from a particular latitude and longitude in sql query
body: <p>I've a database table in which there are 4 columns.</p>
  
  <pre><code>1. id
  2. person_name
  3. country
  4. zip_code
  </code></pre>
  
  <p>Now I want all the zip codes with their real latitude and longitude which come in a given radius of 10 mile from a given lat long.</p>
  
  <p>suppose my latitude and longitudes are <strong>(19.24947300,72.85681400)</strong> and distance is 10 mile, then what SQL query should I make to return all nearest zip codes and their lat longs. </p>
  
  <p>I only have the following query </p>
  
  <pre><code>SELECT ((ACOS(SIN($lat * PI() / 180) * SIN(lat * PI() / 180) + COS($lat * PI() 
  / 180) * COS(lat * PI() / 180) * COS(($lon – lon) * PI() / 180)) * 180 / PI()) * 60 *
  1.1515) AS `distance` FROM `members` HAVING `distance`&lt;=’10’ ORDER BY `distance` ASC
  </code></pre>
  
  <p>But it requires the lat longs of all zip codes in the table but I want them in run time.</p>