I am trying to create a layer that contains all of the businesses in Los Angeles proper. I have a shapefile for the polyon of the LA boundaries (shp_laboundaries) and I have a set of points in the la region for the businesses (tmp_coords). So I want to do a query where I can find all of the points that fall within this polygon. In fact I want to create a new layer from these points.
I was having trouble getting the st_within query to reference a separate layer in postgis. I was trying a few different queries, but hopefully someone can tell me the correct form.
select * from tmp_coords where st_within(tmp_coords.st_loc, public."shp_laboundary");
select * from tmp_coords where st_within(st_loc, select geom from shp_laboundary);