使用选择命令在列中插入值

时间:2018-09-03 05:12:57

标签: postgresql

我使用了以下代码-

alter table locality_town_overlap_v1 
add column Area_L_T double precision 

insert into locality_town_overlap_v1(Area_L_T) 
values (Select ST_Area(ST_Transform(locality_town_overlap_v1.geom,32645)) as area from locality_town_overlap_v1)

但出现错误

ERROR:  syntax error at or near "Select"
LINE 4: values (Select ST_Area(ST_Transform(locality_town_overlap_v1...

1 个答案:

答案 0 :(得分:0)

您必须在子选择项的前面加上一对括号。

但是最好还是写

INSERT INTO locality_town_overlap_v1(Area_L_T) SELECT ...