I have seen a similar question to Counting points in polygon using weight and class simultaneously, but I was unable to operationalize the answer that I found so far.
I have a point layer with attribute values by groups that I would like to assign to the cells of a grid layer as sums of the different groups.
Ideally, I would receive one column for each group with the summed values of the group that are contained within the grid cells. How can achieve that?
I was going to try a suggestion involving virtual layers, but didn't fully understand which specific parts of the suggested code would need to be replaced with my layer names.






My point layer "PupilNo" has one column for each year (e.g. "1894") with values (>=0 ) for groups that are defined in a different column ("Society") of the point layer while my grid cell layer "1894SocietySums" only has an "id" column that I would want to link the sums by group and year to.
– NiBau Jun 22 '20 at 12:31SELECT st_union(B.geometry), B."id", SUM(D."1894") FROM "1894SocietySums" AS B JOIN "PupilNo" AS D ON contains(B.geometry, D.geometry) GROUP BY D."Society"
but it doesn't seem to work.
– NiBau Jun 22 '20 at 12:36