[postgis-users] geos based spatial queries

David Blasby dblasby@refractions.net
Thu Nov 20 19:37:57 2003


Peter Aberline wrote:

> select count(*)
> from points
> where within(points.the_geom, (select the_geom
>                                                               from states
>                                                               where
> state_name = 'BigState')) = true;

try:


SELECT count(*) FROM points WHERE
  within(points.the_geom, (select the_geom from states   where 
state_name = 'BigState')  AND
points.the_geom && (select the_geom from states   where  state_name = 
'BigState')