我正在运行 PostgreSQL 9.2
。
以下是一段我巨大而丑陋查询
的示例:
with cte as(
select ....... from aTable
),cte1 as (
select ..... from bTable inner join cte using(anID)
),update_cte as(
update cte set aField=(select somthing from cte1)
)
select * from cte
我需要创建一个带有最终结果的视图
。
在执行上述操作时,我遇到了以下错误。
ERROR: relation "cte" does not exist
我知道我在做一些不好的事情。希望您能理解我从上面的查询中试图实现的内容。请建议任何替代方法。
感谢回复。
注意:实际查询请参见此链接。
WITH RECURSIVE
吗? - user3814846