I tried Recess almost one month. But i don't have any idea how to use SQL aggregate functions.
Anybody can help?
There is a method named 'selectAs' on Models that allows you to do an aggregate operation.
ex: $modelsWithDistance = $model->all()->selectAs('ABS(someIntColumn - 5)', 'distance')
Now when you iterate over the results of $modelsWithDistance there should be a new property 'distance' that contains the aggregate field.
This should cover your scenario, but if not let us know.