[postgis-users] Can't load aggregation query in qgis - row_number() over() as id

Rémi Cura remi.cura at gmail.com
Fri Mar 28 02:20:59 PDT 2014


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 <pierigis at 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 at lists.osgeo.org
> http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20140328/0875ed7d/attachment.html>


More information about the postgis-users mailing list