Using modifyElementsQuery() to build a Radius Search?
So it turned out that the distance column error was sending us down the wrong path.

The issue was caused by 2 things:

1) As the original Craft entries query was using ids() any select string added via addSelect was being disregarded, the answer here was to move this logic into the having clause.

2) The second issue that was preventing the having clause from working was a missing groupBy clause.

The modifyRadiusQuery code in full:

private function modifyRadiusQuery(DbCommand $query, $value)
{
    $settings = $this-&gt;getSettings();
    $measurementUnit = $settings-&gt;unit == 'mi' ? 3959 : 6371;

    $geo = craft()-&gt;logic-&gt;stringToGeo($value['location']);

    if($geo)
    {
        $haversine = $this-&gt;haversine($geo['lat'], $geo['lng']);

        // ids()
        $query-&gt;join(Logic_GeoRecord::TABLE_NAME.' geo', 'elements.id = geo.elementId');
        $query-&gt;having($haversine.' &lt; '.$value['radius']);
        $query-&gt;group('geo.lat, geo.lng');

        // find()
        // $haversine = $this-&gt;haversine($geo['lat'], $geo['lng']);
        // $query-&gt;addSelect($haversine.' AS distance');    
        // $query-&gt;join(Logic_GeoRecord::TABLE_NAME.' geo', 'elements.id = geo.elementId');
        // $query-&gt;having('distance &lt; '.$value['radius']);
        // $query-&gt;group('geo.lat, geo.lng');
    }
}


The DBCommand query that was fixed:

        $query-&gt;join(Logic_GeoRecord::TABLE_NAME.' geo', 'elements.id = geo.elementId');
        $query-&gt;having($haversine.' &lt; '.$value['radius']);
        $query-&gt;group('geo.lat, geo.lng');