[postgis-devel] Non-Join Join

Obe, Regina robe.dnd at cityofboston.gov
Fri Jul 18 14:13:02 PDT 2008


How about

SELECT A.gid, A.geom, A.letter
FROM (SELECT * FROM lettertable WHERE letter = 'A') A 
LEFT JOIN (SELECT * FROM lettertable WHERE letter = 'B') B 
	ON ST_DWithin(A.the_geom, B.the_geom, 1000)
WHERE B.gid IS NULL;

-----Original Message-----
From: postgis-devel-bounces at postgis.refractions.net
[mailto:postgis-devel-bounces at postgis.refractions.net] On Behalf Of Paul
Ramsey
Sent: Friday, July 18, 2008 5:06 PM
To: PostGIS Development Discussion
Subject: [postgis-devel] Non-Join Join

Brain freeze:

Give a table

gid integer
geom geometry
letter varchar

where letter is a single letter,

how to efficiently find all the instances of the letter 'A' that are
more than 1000m from any letter 'B'.

P.
_______________________________________________
postgis-devel mailing list
postgis-devel at postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-devel
-----------------------------------------
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-devel mailing list