[postgis-users] Update field from expression

Ture Pålsson ture.palsson at gmail.com
Fri Jan 28 05:10:59 PST 2011


2011/1/28 Birgit Laggner <birgit.laggner at vti.bund.de>:
> UPDATE permit_sites p_s SET huc = giddy.h_gid FROM (SELECT p.gid p_gid,
> h.gid h_gid FROM permit_sites p inner join huc8 h on p.the_geom @ h.the_geom
>  WHERE ST_Within(p.the_geom,h.the_geom)) AS giddy WHERE p_s.gid=giddy.p_gid;

Is there something wrong with simply doing

UPDATE permit_sites p
SET huc = h.gid
FROM huc8 h
WHERE ST_Within(p.the_geom, h.the_geom)

?

(Assuming that is what the OP wanted to do, of course...)



More information about the postgis-users mailing list