Hey, I'm not an expert, I would say the first thing would be to create a table with this query, then try to load the result into qgis.
Another option is to encapsulate your group by into a sub querry, QGis might be confused by the number of rows. Try : SELECT * FROM ( SELECT row_number() over() as id, st_collect(geom) as geom, field3, field4, field5, field6 FROM schema.table where field6 is not null group by 3,4,5,6 ) AS sub Cheers, Rémi-C 2014-03-27 17:27 GMT+01:00 Pietro Rossin <pieri...@gmail.com>: > Hello all > I need to aggregate geometries and load them in qgis > > I made a query like this, without success.. > > SELECT row_number() over() as id, st_collect(geom) as geom, field3, field4, > field5, field6 > FROM schema.table > where field6 is not null > group by 3,4,5,6 > > Qgis don't load the layer with message: > > "layer PostgreSQL not valid - level 1" > > Where am I wrong? > Thank you all > Pietro > > > > -- > View this message in context: > http://postgis.17.x6.nabble.com/Can-t-load-aggregation-query-in-qgis-row-number-over-as-id-tp5005981.html > Sent from the PostGIS - User mailing list archive at Nabble.com. > _______________________________________________ > postgis-users mailing list > postgis-users@lists.osgeo.org > http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users >
_______________________________________________ postgis-users mailing list postgis-users@lists.osgeo.org http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users