[postgis-users] spatial update SQL

Ethan Alpert ealpert at digitalglobe.com
Tue Aug 31 09:44:36 PDT 2004



It might be easier but it might be wrong also. What happens with your
query when a cell has no intersects? You're assigning the selected
column to the entire column of cells. There's no guarentee with your
query that the column lengths of the left and right side of your
assigment "match" up.

-e


Wouldnt it be easier just to do:

update cells set depth =
(
       select avg(depth)
        FROM bathy_points 
                  WHERE bathy_points.the_geom && cells.the_geom );

Sub-queries are your friend!

dave
_______________________________________________
postgis-users mailing list postgis-users at postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users



More information about the postgis-users mailing list