我需要幫助來更新這個查詢:轉換查詢處理關鍵值列
$query = sprintf(
"SELECT
lat,
lng,
(
3959 * acos(cos(radians('%s')) *
cos(radians(lat)) *
cos(radians(lng) - radians('%s')) +
sin(radians('%s')) *
sin(radians(lat))
)
) AS distance
FROM
markers
HAVING
distance < '%s'
ORDER BY
distance LIMIT 0 , 20"
與表結構,如:
lat | lng
23.0324234 | -103.0324234
要查詢,我可以從一個搶shipping_lat
和shipping_long
鍵值列結構如下:
meta_key | meta_value
shipping_lat | 23.0324234
shipping_long | -103.0324234
您可能還想看看MySQL的[GIS擴展](http://dev.mysql.com/doc/en/gis-introduction.html)。 – eggyal
@dcolumbus我們希望您付出努力。您嘗試過什麼? –