There are two layers
- polygon
'BereichBerechnung'
with a field"Are_Number"
- points
'EW2017'
with a field"EWjeAdr"
In QGIS with a Virtual Layer, I want to calculate the sum of the field "EWjeAdr"
for points that are within each feature from the layer 'BereichBerechnung'
.
I have found Updating field to give count of points in polygon using STIntersects? which seems related but I cannot figure out how to adjust my expression properly.
With this code:
SELECT Are_Number, SUM(EWjeAdr)
FROM BereichBerechnung
JOIN EW_Data ON BereichBerechnung.ogr_geometry.STContains(EW2017.ogr_geometry) = 1;
GROUP BY Are_Number
I am getting the following error:
How can I do it?