Calculating Distance with SQL

It sometimes makes work a bit easier when you calculate certain operations directly with SQL.
A practical example is the calculation of distances. In some projects I calculated this with PHP.

It can also be done directly with SQL:
SELECT *, SQRT(POW(L2.lat - L1.lat, 2) + POW(L2.lng - L1.lng, 2)) AS Distance

Via

Leave a Reply