[postgis-users] join and intersect() over 3 tables

Torsten Lange tlange at gwdg.de
Tue Jul 3 16:57:14 PDT 2007


I have different data characterizing subsurface drillings distributed 
over two tables (master_data_table, geological_column_table) and I need 
both tables to join. The master_data_table has a geometry (points). The 
join must spacially intersect with a specific area (study_area_table - 
polygon). Ok. I know how to intersect two geometries. And I know how to 
join tables. How do I have to combine it correctly for all three tables? 
Can I use for instance the join syntax also for the intersection 
function - similar to "table1 inner join table2 
on(intersection(master_data_table.geom, study_area.the_geom)) inner join 
table3 on(table1.id=table3.id) ..."?

That's what I use for intersecting two geometries.
SELECT drilling_data_1,
       intersection (master_data_table.the_geom, 
study_area_table.the_geom ) AS the_geom
  FROM master_data_table, study_area_table
 WHERE IsEmpty (Intersection (master_data_table.geom, 
study_area_table.the_geom)) = FALSE;

Thank you for help, Torsten

More information about the postgis-users mailing list