如何将几何数据从一个表中取出到另一个表中?

时间:2015-11-25 21:03:41

标签: postgresql join postgis qgis

我有一个关于我想在两张桌子之间做的连接的问题。我有一个表,它没有从另一个表中获得我需要的几何数据。有没有一种简单的方法可以在我的另一个表中获取数据?

日Thnx See screenshot over here

1 个答案:

答案 0 :(得分:4)

UPDATE syntax是:

[ WITH [ RECURSIVE ] with_query [, ...] ]
UPDATE [ ONLY ] table [ [ AS ] alias ]
    SET { column = { expression | DEFAULT } |
          ( column [, ...] ) = ( { expression | DEFAULT } [, ...] ) } [, ...]
    [ FROM from_list ]
    [ WHERE condition | WHERE CURRENT OF cursor_name ]
    [ RETURNING * | output_expression [ [ AS ] output_name ] [, ...] ]
UPDATE TableB AS B
SET geom = A.geom
FROM TableA AS A
WHERE B.join_id = A.id 

注意

我在geom上看不到列TableB,因此您可能需要先创建列

ALTER TABLE TableB ADD COLUMN geom geometry;