[postgis-users] SELECT problem

Obe, Regina robe.dnd at cityofboston.gov
Tue Sep 23 07:40:32 PDT 2008


 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.




More information about the postgis-users mailing list