Hitung jarak terdekat di sql
Contoh query :
dimana
Latitude =-6.827920461143512
Longitude =107.4349594116211
SELECT name,latitude,longitude
,111.045* DEGREES(ACOS(COS(RADIANS(-6.827920461143512))
* COS(RADIANS(latitude ))
* COS(RADIANS(107.4349594116211) - RADIANS( longitude ))
+ SIN(RADIANS(-6.827920461143512))
* SIN(RADIANS( latitude ) ))) AS distance_in_km
from services
ORDER BY distance_in_km asc;
hasil
Sumber referensi
Komentar
Posting Komentar