title: SQL Query for Performing Radius Search based on Latitude Longitude
body: <p>We have a <code>restaurant</code> table that has lat-long data for each row. </p>
  
  <p>We need to write a query that performs a search to find all restaurants within the provided radius e.g. 1 mile, 5 miles etc.</p>
  
  <p>We have the following <code>query</code> for this purpose:</p>
  
  <pre><code>***Parameters***
  
  Longitude: -74.008680
  Latitude: 40.711676
  Radius: 1 mile
  
  ***Query***
  
  SELECT *
  FROM restaurant
  WHERE (
  POW( ( 69.1 * ( Longitude - -74.008680 ) * cos( 40.711676 / 57.3 ) ) , 2 ) + POW( ( 69.1 * ( Latitude - 40.711676 ) ) , 2 )
  ) &lt; ( 1 *1 );
  </code></pre>
  
  <p>The table has about 23k rows. The size of the result set is weird at times e.g. for a 5.4 mile search, it gives back 880 rows and for 5.5 miles, it gives back 21k rows.</p>
  
  <p>This table contains restaurant data for nyc - so the real distribution is not as per the result set.</p>
  
  <p>Question: IS THERE ANYTHING WRONG With this query?</p>
  
  <blockquote>
    <p>DB: MySQL, Longitude: DECIMAL(10,6), Latitude: DECIMAL(10,6)</p>
  </blockquote>