ubceats / foodfoodfood

🍕 UBCEats: A web portal for food items at UBC
http://www.ubceats.ca
3 stars 0 forks source link

find nearest #15

Open falkirks opened 6 years ago

falkirks commented 6 years ago
SELECT *,
3956 * 2 * ASIN(SQRT( POWER(SIN((49.260605 - abs(loc.latitude)) * pi()/180 / 2),2) + COS(49.260605 * pi()/180 ) * COS(abs(loc.latitude) *  pi()/180) * POWER(SIN((-123.245994 - loc.longitude) *  pi()/180 / 2), 2) ))
as distance FROM locations loc ORDER BY distance;
agottardo commented 6 years ago

Did you come up with that math on your own? 😛