【发布时间】:2013-05-22 09:38:00
【问题描述】:
我想获得 10 个最近的经度和纬度位置。我将经度和纬度存储为双倍。我试过这个:
SELECT * FROM company as dest where 3956 * 2 * ASIN(SQRT( POWER(SIN((122.4058 - abs( dest.latitude)) * pi()/180 / 2),2) + COS(122.4058 * pi()/180 ) * COS( abs (dest.latitude) * pi()/180) * POWER(SIN((37.7907 – dest.longitude) * pi()/180 / 2), 2) )) as dis <10 and ORDER BY dis limit 10;
但我收到此错误:
#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '– dest.longitude) * pi()/180 / 2), 2) )) as dis <10 and ORDER BY dis limit 10 ' at line 1
如何解决这个错误?
【问题讨论】:
-
里面多了一个括号
)..找出来 -
@AhmedZ。那么错误就不存在了。
-
有 16 个括号打开和 16 个括号关闭!
-
现在还没有找到丢失的括号!
-
我已经添加了,现在我得到这个错误:#1582 - 调用本机函数'POWER'中的参数计数不正确
标签: mysql latitude-longitude closest-points mysql-select-db