[postgis-users] SELECT problem

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


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