[postgis-users] INTERSECT TWO TABLES

strk strk at keybit.net
Sun Apr 4 07:43:21 PDT 2004


On Sun, Apr 04, 2004 at 04:33:53PM +0200, Erwan Bocher wrote:
> Hi,
> 
> 
> 
> I'm novice in POSTGIS. I'd like to intersect two tables witch contains polygons. The query must return another table with all polygon intersection.
> 
>  
> 
> I've used this query :
> 
>  
> 
> select intersection((select the_geom from parcelle1),(select the_geom from parcelle2)) into tabintersection;
> 

SELECT intersection(p1.the_geom, p2.the_geom) INTO tabintersection
	FROM  parcelle1 p1, parcelle2 p2 WHERE p1.oid != p2.oid;

Note that the WHERE clause (missing on your query) is needed to
avoid useles intersection of geometris with themselves (if you need
that omit the WHERE clause).

--strk;

>  
> 
> but return error "more than one row returned by a subquery used as an expression"
> 
>  
> 
> Could you help me ?
> 
>  
> 
> Thanks
> 
> 
> 
> Erwan
> 
>  

> _______________________________________________
> postgis-users mailing list
> postgis-users at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users




More information about the postgis-users mailing list