离我最近距离 sql
CREATE FUNCTION getDistance (latl FLOAT, lonl FLOAT, lat2 FLOAT, lon2 FLOAT)
RETURNS FLOAT
DETERMINISTIC
RETURN ROUND(6378.138 * 2 * ASIN(SQRT(PON(SIN((latl * PI() / 180 - lat2 * PI() / 180) / 2), 2) + COS(latl * PI() / 180) *
C0S(lat2 * PI() / 180)
* PON(SIN(( lonl * PI() / 180 - lon2 * PI() / 180 ) / 2),2))),2);