[Qgis-user] Re:postgis layer from a view

Lionel Roubeyrie lionel.roubeyrie at gmail.com
Wed Jun 2 08:58:12 PDT 2010


Is it a postgis provider problem or does it come from an invalid
table/view formating?
thanks

2010/6/2 Lionel Roubeyrie <lionel.roubeyrie at gmail.com>:
> Hi all,
> thanks for your help, effectively I didn't take care about duplicated
> gids. To avoid this, I have changed the view to :
> SELECT
>    com.gid,
>    com.the_geom,
>    com.region,
>    nrj_com.*
> FROM
>    (SELECT
>        nrj.commune,
>        sum(nrj.cha) AS cha,
>        sum(nrj.ecs) AS ecs,
>        sum(nrj.cui) AS cui,
>        sum(nrj.spe) AS spe,
>        sum(nrj.total) AS total
>    FROM residentiel.nrj_sourcesfixes nrj
>    GROUP BY nrj.commune
>    ) AS nrj_com
> JOIN spatial.commune com ON nrj_com.commune::text = com.code_insee::text;
>
> where "select count(gid) from <view> group by gid having count(gid)>1"
> returns nothing.
> However, QGIS complains again about not finding uniques int4 values,
> but performing a CREATE TABLE table AS <query_creating_view> is
> perfectly displayed in QGIS!!!!
>
> Cheers
>
> 2010/6/1 Andrea Peri 2007 <aperi2007 at gmail.com>:
>> Hi Lionel,
>>
>> try a query like this:
>>
>> select count(gid) from <view> group by gid having count(gid)>1
>>
>> to see if there is some duplicates.
>>
>> Regards,
>>
>> Andrea.
>>
>> _______________________________________________
>> Qgis-user mailing list
>> Qgis-user at lists.osgeo.org
>> http://lists.osgeo.org/mailman/listinfo/qgis-user
>>
>
>
>
> --
> Lionel Roubeyrie
> lionel.roubeyrie at gmail.com
> http://youarealegend.blogspot.com
>



-- 
Lionel Roubeyrie
lionel.roubeyrie at gmail.com
http://youarealegend.blogspot.com



More information about the Qgis-user mailing list