3

I've managed to create the below statement that creates a table based on a point in polygon query. However it creates a column that gives a true/false value which I then delete out all the f values from. Is there a better way of producing this statement?

CREATE TABLE crime_test AS 
SELECT a.*, b.town, ST_within(a.the_geom, b.the_geom) "within"
FROM crime_data a, nh_areas b;
DELETE FROM crime_test WHERE within = 'f'

1 Answer 1

7

Think you need a WHERE clause:

CREATE TABLE crime_test AS 
SELECT a.*, b.town
FROM crime_data a, nh_areas b
WHERE ST_Within(a.the_geom, b.the_geom);
3

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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