的最小函數值我有一個表與餐館連鎖店的GPS位置,並想返回最近的餐館的地址,以點(A)一定半徑SQLite的選擇分組結果
SELECT *
, MIN(distance($lat, $lon, lat, lon)) as miles
FROM all_restaurants
WHERE lat between $lat1 and $lat2
AND lon between $lon1 and $lon2
AND miles < $miles
GROUP BY restaurant_id
ORDER BY miles ASC
, company_name ASC
LIMIT 500
回報誤差範圍內
誤用骨料的:)MIN(