SELECT id,lat,lng,
( 6371 * acos( cos( radians( 37 ) ) * cos( radians( lat ) )
* cos( radians( lng ) - radians( 121 ) ) + sin( radians( 37 ) )
* sin( radians( lat ) ) ) ) AS distance FROM map having distance<10 ORDER BY distance limit 0,30;
SELECT id,lat,lng,
( 6371 * acos( cos( radians( 37 ) ) * cos( radians( lat ) )
* cos( radians( lng ) - radians( 121 ) ) + sin( radians( 37 ) )
* sin( radians( lat ) ) ) ) AS distance FROM map having distance<10 ORDER BY distance limit 0,30;