在 PostgreSQL 8.4 中,我想从 3 个具有 id 的表中创建一个视图。所以我想在我看来有这个结构:
num serial,
name_dispatcher character varying(250)
the_geom geometry
我可以从表name_dispatcher
中进行选择:the_geom
CREATE VIEW lineView
AS SELECT 'name' AS name_dispatcher, the_geom
FROM line1
UNION
SELECT 'name' AS name_dispatcher, the_geom
FROM line2
UNION
SELECT 'name' AS name_dispatcher, the_geom
FROM line3
如何num
在视图中创建列?
更新
我找到了一个解决方案:
ROW_NUMBER() OVER(ORDER BY lineView.voltage)
但我不知道如何在ALTER VIEW
. 我怎么把它放在那里?