[postgis-users] Select Count

MarkW mark.wimer at gmail.com
Thu Aug 20 15:17:34 PDT 2009


I don't necessarily understand all of your query, but consider:
+ the DISTINCT keyword for when you're joining tables that might multiply
records.
+ I don't see the graphics.spatial_ref joined - could it be a join is
missing?
Mark


On Thu, Aug 20, 2009 at 12:33 PM, Bob Pawley <rjpawley at shaw.ca> wrote:

>  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
>
> _______________________________________________
> postgis-users mailing list
> postgis-users at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20090820/f951073b/attachment.html>


More information about the postgis-users mailing list