The following query returns the venues near us (lat: 62.0, lon: 25.0) inside whose radius we fall in ordered by distance:
SELECT *, earth_distance(ll_t
You can also create stand alone or packaged function and use it in your queries:
SELECT * FROM ... WHERE distance <= your_function() -- OR your_package_name.your_function() ORDER BY ...
You can use your function in select:
Select your_function() From your_table... Where ...