I'm using PostGreSQL 9.3 and the latest PostGIS to store shapefiles.
I have a table, named zonages_region, that contains 76 polygons.
I added a new column in order to store the superficy of the polygons.
The geometry of the polygons is stored in the "geom" column.
I have this request :
INSERT INTO zonages_region(superficie)
SELECT ST_AREA(geom::geography)/1000000 FROM zonages_region
The SELECT is stored in the table, but it creates new rows instead of starting at the first one.
As I have already 76 rows for my polygons, the INSERT starts to insert at the row 77.
How can I do the INSERT to start at the first row, so it will match the polygons rows already existing ?
That should be an UPDATE
. Like this:
UPDATE zonages_region
SET superficie = ST_AREA(geom::geography)/1000000
Without WHERE
condition, every row in the table is updated.
Details about UPDATE
in the manual.
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments