Skip to main content
added 86 characters in body
Source Link
Taras
  • 35.8k
  • 6
  • 77
  • 152

There is a possibility using a "Virtual Layer" through Layer > Add Layer > Add/Edit Virtual Layer...

Let's assume there is a polygon layer called 'grid_test' (red squares).

input

With the following query, it is possible to dissolve two fields while summing a third field.

SELECT GROUP_CONCAT("id") AS ids,
       SUM("AREASQM") AS SUM_AREASQM,
       ST_union(geometry) AS geom
FROM "grid_test"
GROUP BY "Inundation", "EVC_BCS"

Here the ST_Union() function was used.

The output polygon layer (yellow) with its attribute table will look like

result

There is a possibility using a "Virtual Layer" through Layer > Add Layer > Add/Edit Virtual Layer...

Let's assume there is a polygon layer called 'grid_test' (red squares).

input

With the following query, it is possible to dissolve two fields while summing a third field.

SELECT GROUP_CONCAT("id") AS ids,
       SUM("AREASQM") AS SUM_AREASQM,
       ST_union(geometry) AS geom
FROM "grid_test"
GROUP BY "Inundation", "EVC_BCS"

The output polygon layer (yellow) with its attribute table will look like

result

There is a possibility using a "Virtual Layer" through Layer > Add Layer > Add/Edit Virtual Layer...

Let's assume there is a polygon layer called 'grid_test' (red squares).

input

With the following query, it is possible to dissolve two fields while summing a third field.

SELECT GROUP_CONCAT("id") AS ids,
       SUM("AREASQM") AS SUM_AREASQM,
       ST_union(geometry) AS geom
FROM "grid_test"
GROUP BY "Inundation", "EVC_BCS"

Here the ST_Union() function was used.

The output polygon layer (yellow) with its attribute table will look like

result

Source Link
Taras
  • 35.8k
  • 6
  • 77
  • 152

There is a possibility using a "Virtual Layer" through Layer > Add Layer > Add/Edit Virtual Layer...

Let's assume there is a polygon layer called 'grid_test' (red squares).

input

With the following query, it is possible to dissolve two fields while summing a third field.

SELECT GROUP_CONCAT("id") AS ids,
       SUM("AREASQM") AS SUM_AREASQM,
       ST_union(geometry) AS geom
FROM "grid_test"
GROUP BY "Inundation", "EVC_BCS"

The output polygon layer (yellow) with its attribute table will look like

result