I have a three different tables:
- Polygons1
| Name1 | Geom |
|---|---|
| Name... | POLYGON.. |
| Cell 3 | Cell 4 |
- Polygons2
| Name2 | Geom |
|---|---|
| Name... | POLYGON.. |
| Cell 3 | Cell 4 |
- Points
| ID | Num | Geom |
|---|---|---|
| ID... | 54 | POINT... |
| Cell 3 | 33 |
I want to find where are polygons interesected and inside that area of intersection to sum points attribute - Num.
I tried this query:
SELECT sum(Num) as total, Polygons1.Name1
from Points,
Polygons1,
Polygons2
where ST_intersects(Polygons1.geom , Polygons2.geom)
GROUP BY Polygons1.Name1
This query returns some really big sum numbers that are not correct. Please help.