Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I have three tables I need to intersect but not sure how to get the third Heres what I have so far:

SELECT nyc_neighborhoods.name, SUM(nyc_census_blocks.popn_total) AS POP
FROM nyc_neighborhoods
JOIN nyc_census_blocks
ON ST_Intersects(nyc_neighborhoods.the_geom, nyc_census_blocks.the_geom)
WHERE nyc_neighborhoods.boroname = 'Manhattan'
Group By nyc_neighborhoods.name

I need to incorprate subway stations with in Manhattan from our ny_subway_stations table

How do you insterect/join 3 tables?

Thanks, Adam

share|improve this question

1 Answer 1

You can just add more joins:

SELECT nyc_neighborhoods.name, SUM(nyc_census_blocks.popn_total) AS POP
FROM nyc_neighborhoods
   JOIN nyc_census_blocks
     ON ST_Intersects(nyc_neighborhoods.the_geom, nyc_census_blocks.the_geom)
   JOIN ny_subway_stations 
     ON ST_Intersects(nyc_neighborhoods.the_geom, ny_subway_stations.the_geom)
WHERE nyc_neighborhoods.boroname = 'Manhattan'
Group By nyc_neighborhoods.name
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.