I have 2 table postgresql postgis 1 table polygon (A,B,C,D) and 1 table point (1,2,3,4) I want to query select all polygon has contain point (A,B,C) How can i do it.
CodePudding user response:
You can use the where exists
clause to select the polygons if there 1 or more point inside:
SELECT *
FROM myPolygonLayer p
WHERE EXISTS (
SELECT 1
FROM myPointLayer pt
WHERE st_intersects(p.geom, pt.geom)
)