我正在尝试更新脚本,以便它使用 POINT 值而不是“纬度/经度”列来尝试帮助进行地理搜索(距离范围)。所以我有此专栏:
`point_test` point DEFAULT NULL
..我正在尝试通过以下方式设置它:
UPDATE glinks_Links SET
point_test = POINT(52.35462 4.88227) WHERE ID = 3693134
但它给出了mySQL错误:
#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 '4.88227) WHERE ID = 3693134' at line 2
我找到了一篇有关空间点的博客文章,并建议运行它:
SELECT * FROM INFORMATION_SCHEMA.ST_SPATIAL_REFERENCE_SYSTEMS
但是我得到这个错误:
#1109 - Unknown table 'ST_SPATIAL_REFERENCE_SYSTEMS' in information_schema
我是否需要在mysql.conf文件中打开空间?
仅供参考,我正在运行 mySQL Ver 14.14 Distrib 5.7.27
答案 0 :(得分:1)
在更新语句中,您错过了逗号。查询应如下所示,在经度和纬度之间用逗号分隔:
UPDATE glinks_Links SET point_test = POINT(52.35462, 4.88227) WHERE ID = 3693134;