2013-09-26 132 views

回答

1

您可以根據給定的位置找出最近的位置,因爲我希望看到特定距離上的建築物出租或出售...顯示在查詢下方。

SELECT 
    id, 
    imageURL, 
    title, 
    description, 
    footnote, 
    lat, 
    lon, 
    (
    (
     (
     ACOS(
      SIN((:lat1 * PI()/180)) * SIN((lat * PI()/180)) + COS((:lat2 * PI()/180)) * COS((lat * PI()/180)) * COS((:LONG - lon) * PI()/180) 
     ) 
    ) * 180/PI() 
    ) * 60 * 1.1515 * 1.609344 * 1000 
) AS distance, 
    iconID, 
    objectID, 
    transformID 
FROM 
    POI_RealEstate 
WHERE title REGEXP :search 
HAVING distance < :radius 
ORDER BY distance ASC 
LIMIT 0, 50 
相關問題