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
最佳答案
原文链接:https://www.f2er.com/mysql/531917.html