I’m trying to copy a table named “CLOUD” to a new one named “t1_temp” while grouping the rows based on a column named “tag”. BUT i want this to happen only if the “NeighborhoodID” column is the same.
The query i’m running is:
INSERT INTO t1_temp (id, NeighborhoodID, power, tag)
SELECT id, NeighborhoodID, SUM(power), tag
FROM CLOUD GROUP BY tag ORDER BY NeighborhoodID
So for example:

The third entry shouldn’t be grouped with the 1th & 4th entry’s because the “NeighborhoodID” isn’t the same.
I hope i’m clear, if not please comment, thanks.
You can group by multiple columns, so: