简体   繁体   English

来自不同表的多边形中包含的MySQL选择点

[英]MySQL select points which are contained in a polygon from a different table

I have two tables. 我有两张桌子。

Table a contains a list of names and locations (points) Table b contains a list of names and shape (polygons) 表a包含名称和位置(点)的列表表b包含名称和形状(多边形)的列表

I want to write a query to find all points from a which are contained inside a given town from b 我想写一个查询来查找a中所有包含在b中给定城镇中的点

Something along the lines of 遵循以下原则

select name from tblshops where st_contains(select shape from tbltowns where name="London", location)

but I keep getting a syntax error. 但我不断收到语法错误。 What am I doing wrong? 我究竟做错了什么? Thanks 谢谢

SELECT 
   name 
FROM 
   tblshops
WHERE 
   st_contains((select shape from tbltowns where name='London'), location)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM