开发者

Adding data to multiple records

开发者 https://www.devze.com 2023-01-21 00:10 出处:网络
I have a project with various parts.... One of which is the calculate the area of all the polygons on a map.When I run the query \"select st_area(nycpp.the_geom) from nycpp;\"I get a list of all the a

I have a project with various parts.... One of which is the calculate the area of all the polygons on a map. When I run the query "select st_area(nycpp.the_geom) from nycpp;" I get a list of all the areas.

Next, I tried adding the results of the query to the nycpp table with UPDATE nycpp SET 开发者_JAVA百科area_sizes = (select st_area(nycpp.the_geom) from nycpp); but get the error -- "more than one row returned by a subquery used as an expression"

I figured out why am I getting the error... what I can not figure out is how write a script that will update all 12K+ records....

Can someone give an example or a link to info on updating multiple records

The database I'm using is PostGIS

Thanks Chris


You are making it to complicated. Try:

UPDATE nycpp set area_sizes=ST_Area(the_geom);

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号