I have a separate table for points and polygons. The polygons are overlapped or intersect with each other. The points are within several polygons at the same time. I need to develop an SQL query which should show the points that are in the polygons. If I use an SQL query like this:
SELECT point_table.geom, polygon_table.name FROM point_table
INNER JOIN polygon_table on ST_Within(point_table.geom, polygon_table.geom);
It does not iterate through all polygons, instead it evaluates the point geometry with the innermost polygon and does not evalute the point geometry with other overlapped or intersected polygons. What I need is to evaulate all points with all polygons. Becuase points can be within several polygons at the same time.
For instance, if 10 points are within 3 overlapped polygons, it should return 30 records and each record/row should have the corresponding polygon_table.name in it. And in this situation, the above query is returning 10 records with polygon_table.name from the innermost polygon, i.e once it finds the match, it is not evaluating the points against other polygons.
Any help on this matter appreciated.
Thanks.