I'm trying to create a shapefile of the state of zip codes (in this example, I pick Virginia). However, the zip codes do not line up exactly to the state borders. So I run the following query to get a shapefile of the zip codes for the given state.
SELECT uszips.geoid10, uszips.geom FROM uszips,va_shp WHERE ST_Intersection(uszips.geom, va_shp.geom) GROUP BY uszips.geoid10, uszips.geom
When the state of Virginia looks like this:
Is there any way I can return the shapefile with the zip code geom truncated to match the exact borders of the state?