I think that your query is counting rows more than once, because you're doing a "Cartesian Product"; see http://www.dba-oracle.com/t_garmany_9_sql_cross_join.htm
I think you'd want to do something like: select sum(area(a.the_geom)) as sum1,sum(area(b.the_geom))as sum2 from orig1 a,orig2 b where a.id = b.a_id ________________________________ From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Gustavo Ces Sent: Thursday, February 07, 2008 7:35 AM To: PostGIS Users Discussion Subject: [postgis-users] sum or not sum.. Hi all, I´ve got two tables with geoms. When i try to sum(area) something strange happens: select sum(area(the_geom)) from orig1 61301.4750045538 select sum(area(the_geom))from orig2 33996.0705435276 but now... select sum(area(a.the_geom)) as sum1,sum(area(b.the_geom))as sum2 from orig1 a,orig2 b sum1 sum2 11218169.9258333 4963426.29935503 smells like postgresql basic concept unknowed for me.... :( Gus
_______________________________________________ postgis-users mailing list [email protected] http://postgis.refractions.net/mailman/listinfo/postgis-users
