title: laravel having: Column not found
body: <p>my following code is like this:</p>
  
  <pre><code>$places = DivePlace::selectRaw("*,(st_distance_sphere( POINT(".$lon.",".$lat.") ,  point(lon, lat))/1000) as distance")
      -&gt;havingRaw("distance &lt; ".$radius)
      -&gt;orderBy("distance")
      -&gt;paginate(10);
  </code></pre>
  
  <p>without the "havingRaw" everything is good. 
  After adding it, the following error came up:</p>
  
  <blockquote>
    <p>SQLSTATE[42S22]: Column not found: 1054 Unknown column 'distance' in
    'having clause' (SQL: select count(*) as aggregate from <code>dive_places</code>
    having distance &lt; 300)</p>
  </blockquote>
  
  <p>Any solution?</p>