简体   繁体   中英

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)

I want to write a query to find all points from a which are contained inside a given town from 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)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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