[postgis-users] avoid duplicates with lateral auto join

Olivier Leprêtre o.lepretre at gmail.com
Sun May 28 05:18:48 PDT 2017



Doing a lateral auto join return cross results like A,B and B,A. Is there a
simple trick to avoid that ?


To explain : in such query


select o.name,nam1 from 

t1 o,

lateral (select o.name,t1.nam nam1 from t1

where st_overlaps(o.geom,t1.geom)) lat

order by o.name


I get results like


polygon1       polygon2

polygon2       polygon1


because polygon1 overlap polygon2 and conversely.


how could I get only one of those pairs ?








L'absence de virus dans ce courrier électronique a été vérifiée par le logiciel antivirus Avast.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20170528/9a0705c1/attachment.html>

More information about the postgis-users mailing list