title: HAVING distance Greater than and Less than in the same Query
body: <pre><code>SELECT city, (6372.797 * acos(cos(radians({$latitude})) * cos(radians(`latitude_range`)) * cos(radians(`longitude_range`) - radians({$longitude})) + sin(radians({$latitude})) * sin(radians(`latitude_range`)))) AS distance FROM cities WHERE active = 1 HAVING distance &gt; 25 ORDER BY distance ASC
  </code></pre>
  
  <p>I like to be able to grab all cities <code>HAVING</code> a distance greater than 25KM and less than 50KM. Anything I try entering either results in all cities greater than 25KM or an error.</p>
  
  <p>How does one go about adding <code>HAVING distance &gt; 25 AND distance &lt;= 50</code> to my SQL query?</p>