Mysql函数CONTAINS和GEOMFROMTEXT不起作用

前端之家收集整理的这篇文章主要介绍了Mysql函数CONTAINS和GEOMFROMTEXT不起作用 前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

所以我有这种方法,它包含来自mysql的几何函数

select *,(SELECT SUM(t_o.value) FROM tree_operations t_o WHERE t_o.operation_id = operations.id) operationTreeValue,(SELECT COUNT(t_o.id)  FROM `tree_operations` t_o WHERE t_o.operation_id = operations.id) operationTreeNumber,(CASE\r                          WHEN operations.type = 'pieces' THEN (SELECT GROUP_CONCAT(p.name) FROM `pieces` p WHERE p.id IN (SELECT piece_id FROM `piece_row_operations` WHERE operation_id = operations.id))\r                          WHEN operations.type = 'rows' THEN (SELECT GROUP_CONCAT(r.number) FROM `rows` r WHERE r.id IN (SELECT row_id FROM `piece_row_operations` WHERE operation_id = operations.id))\r                          END) AS typeName from `operations` where operations.id IN (SELECT t_o.operation_id FROM `tree_operations` t_o WHERE t_o.tree_id IN (SELECT t.id FROM `trees` t WHERE t.coordinates IN (Contains(GeomFromText('POLYGON(49.816472 35.971209,49.7868 35.970981,49.788668 35.947219,49.15201 35.947905,49.816472 35.971209)'))))) order by `operations`.`id` desc

但是令人惊讶的是,它在服务器上不起作用(尽管在本地完全可以)
在花费大量时间(在不同环境中运行查询等)之后,我无法得到任何可靠的答案.
我的查询有什么问题吗?还是不再起作用的功能
p.s:我在本地的MysqL版本是5.7,服务器是mariadb 10.2

最佳答案
MysqL 5.7.6开始不推荐使用某些GeomFromText()函数.

使用MariaDB @ latest&&改为使用ST_GeomFromText()和ST_(其他函数)

原文链接:https://www.f2er.com/mysql/531917.html

猜你在找的MySQL相关文章