[postgis-users] SELECT problem

Birgit Laggner birgit.laggner at vti.bund.de
Wed Sep 24 00:42:05 PDT 2008


Hi again,

no, I am not... Today, I tried the query again, and I deleted all 
unnessecary attribute fields, so the query looked really like the one I 
sent to the list. And now, it seems like the duplicates originate from 
the first part of the query, where they are absolutely ok because the 
source table contains duplicates. I could swear, yesterday, it was the 
other way round... :-)

Sorry for my stupidity :-) Regards,

Birgit.


Birgit Laggner schrieb:
> Hi Regina,
>
> yes, I am :-)
>
> Regards,
>
> Birgit.
>
> Obe, Regina schrieb:
>>  Birgit,
>>
>> Looks fine to me actually.
>>
>> So are you saying this query generates duplicates?
>>
>> select
>>   a.gid,
>>   a.feldblocki,
>>   a.the_geom
>> from bfn.nw_inv07_oc_rep a
>> except
>> select
>>   a.gid,
>>   a.feldblocki,
>>   a.the_geom
>> from bfn.nw_inv07_oc_rep a, bfn.nw_inv07_ol_test b
>> where a.gid=b.gid_inv07
>> limit 100;
>>
>> Hope that helps,
>> Regina
>>
>> -----Original Message-----
>> From: postgis-users-bounces at postgis.refractions.net
>> [mailto:postgis-users-bounces at postgis.refractions.net] On Behalf Of
>> Birgit Laggner
>> Sent: Tuesday, September 23, 2008 7:42 AM
>> To: PostGis_Mailinglist
>> Subject: [postgis-users] SELECT problem
>>
>> Dear list,
>>
>> probably, I'm just to unexperienced to see what I'm doing wrong, but 
>> that doesn't change that I need help :-)
>>
>> I want to select a test dataset out of a bigger dataset (a). First 
>> part of the test dataset should be the first 100 geometries of (a) 
>> which have
>>
>> ids also occuring in a second dataset (b). Second part should be 100 
>> geometries of (a) whose ids don't match with ids of (b). This is my 
>> sql statement so far:
>>
>> insert into bfn.nw_inv07_oc_rep_test
>> select
>>   a.gid,
>>   a.feldblocki,
>>   a.the_geom
>>  from bfn.nw_inv07_oc_rep a, bfn.nw_inv07_ol_test b
>> where a.gid=b.gid_inv07;
>> insert into bfn.nw_inv07_oc_rep_test
>> select
>>   a.gid,
>>   a.feldblocki,
>>   a.the_geom
>> from bfn.nw_inv07_oc_rep a
>> except
>> select
>>   a.gid,
>>   a.feldblocki,
>>   a.the_geom
>> from bfn.nw_inv07_oc_rep a, bfn.nw_inv07_ol_test b
>> where a.gid=b.gid_inv07
>> limit 100;
>>
>> The first part of the insert works fine, but the result of the second 
>> insert looks strange for me: some rows double or even triple, while 
>> in the origin datasets, there are no duplicate rows.
>>
>> Anybody who could explain what's happening during my query?
>>
>> Thanks a lot,
>>
>> Birgit.
>> _______________________________________________
>> postgis-users mailing list
>> postgis-users at postgis.refractions.net
>> http://postgis.refractions.net/mailman/listinfo/postgis-users
>> -----------------------------------------
>> The substance of this message, including any attachments, may be
>> confidential, legally privileged and/or exempt from disclosure
>> pursuant to Massachusetts law. It is intended
>> solely for the addressee. If you received this in error, please
>> contact the sender and delete the material from any computer.
>>
>> _______________________________________________
>> postgis-users mailing list
>> postgis-users at postgis.refractions.net
>> http://postgis.refractions.net/mailman/listinfo/postgis-users
>>
>>   
>

-- 
Dipl.-Geoökol. Birgit Laggner

Johann Heinrich von Thünen-Institut,
Bundesinstitut für Ländliche Räume, Wald und Fischerei
Institut für Ländliche Räume
Bundesallee 50
38116 Braunschweig

Johann Heinrich von Thünen-Institute
Federal Research Institute for Rural Areas, Forestry and Fisheries
Institute of Rural Areas
Bundesallee 50
D-38116 Braunschweig
Germany

Tel.: (0531) 596 - 5240
Fax: (0531) 596 - 5599
E-Mail: birgit.laggner at vti.bund.de
Internet: www.vti.bund.de




More information about the postgis-users mailing list