Postgresql 有没有一种方法可以在函数中为“table.column”类型的查询别名?
我创建了一个CTE,CTE的第二部分包含一个select和一个st_contains。在这一部分中,我有两列同名的不同表。我想为“table.column”组合中的一个别名,因为我在CTE结束时进行选择时输出错误;列引用不明确Postgresql 有没有一种方法可以在函数中为“table.column”类型的查询别名?,postgresql,postgis,common-table-expression,Postgresql,Postgis,Common Table Expression,我创建了一个CTE,CTE的第二部分包含一个select和一个st_contains。在这一部分中,我有两列同名的不同表。我想为“table.column”组合中的一个别名,因为我在CTE结束时进行选择时输出错误;列引用不明确 with table1 as ( ... ), table2 as ( select* from table3, table4 where st_contains (table3.atribute1,
with
table1 as (
...
),
table2 as (
select*
from table3, table4
where st_contains (table3.atribute1, table4.atribute1)
)
select
table1.atribute1
table2.atribute1 #here i need somethig like table2.table3.atribute1
from table1
join table2 on table1.atribute2=table2.atribute2
;
我希望我能很好地解释这个问题。
谢谢 为table2 CTE中的table3和table4列添加别名以解决歧义 具有 表1 as ... , 表2 as 选择表3.attribute1表3ATRR1、表4.attribute1表4ATTR1 从表3到表4 其中st_包含表3.1和表4.1 选择 表1.1 表2.table3atrr1-使用别名列名 来自表1 将表2连接到表1上。atribute2=表2.atribute2 ;
with子句必须包含一个或多个有效的sql语句。您的第二个缺少选择列表。也没有开盘价。表2为选择表3.attribute1为从中选择的任何内容。。。