#1064 - 您的 SQL 语法有误。要在 '– 附近使用正确的语法

#1064 - You have an error in your SQL syntax. For the right syntax to use near '–

我正在使用查询从我的数据库中获取最近的位置,但出现此错误

我的查询:

SELECT * , 3956 * 2 * ASIN( SQRT (
POWER(SIN((65.97029333 - abs(postLatitude)) * pi()/180 / 2),
2) + COS(65.97029333 * pi()/180 ) * COS(abs(postLatitude) *
pi()/180) * POWER(SIN((-18.53303333 – postLongitude) *
pi()/180 / 2), 2) )) as distance
FROM userpost
HAVING distance < 10
ORDER BY distance 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 '– postLongitude) *
pi()/180 / 2), 2) )) as distance
FROM userpost
having di' at line 4

非常感谢您的帮助。

-18.53303333postLongitude 之间的字符不是 ASCII 减号,而是 EN-dash,Unicode 代码点 342387。将其替换为正常的减号。