[postgis-users] Select Count

Bob Pawley rjpawley at shaw.ca
Thu Aug 20 09:33:19 PDT 2009


Hi 

When I use this expression I get results that are not correct. (More rows than the table p_id.image contains)

select count
  (p_id.image.the_geom) 
 from p_id.image,  processes_count  , p_id.p_id , graphics.spatial_ref
 where p_id.image.p_id_id = processes_count.p_id_id
 and p_id.image.description = 'ip_op_Arrow_name' 
 and  p_id.image.the_geom  |>> p_id.p_id.ithe_geom
 and p_id.image.the_geom << p_id.p_id.one   
 and p_id.p_id.process_number = '1' 
 and p_id.p_id.p_id_id = processes_count.p_id_id;

However, when I use the limited

select count
  (p_id.image.the_geom) 
 from p_id.image,  processes_count  
 where p_id.image.p_id_id = processes_count.p_id_id
 and p_id.image.description = 'ip_op_Arrow_name' ;

the correct results are obtained.

It woiuld appear that rows in other tables are being counted when I attempt to limit the return.

Can anyone suggest a workaround?/

Bob
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20090820/670852ef/attachment.html>


More information about the postgis-users mailing list