Postgresql 错误:表“”的子句条目中缺少;cte“;在CTE中执行查询时
我试图在Postgresql上执行以下操作 我越来越Postgresql 错误:表“”的子句条目中缺少;cte“;在CTE中执行查询时,postgresql,common-table-expression,Postgresql,Common Table Expression,我试图在Postgresql上执行以下操作 我越来越 ERROR: missing FROM-clause entry for table "cte" 单击查看我的原始代码如果未在tempstockpos中定义cte表,则不会在tempstockpos中看到该表。现在显示整个代码。而不是tempstockpos中的,其中。。。。并且tempstockpos.batchid=cte.batchid,则必须在FROM子句中包含cte,如: FROM tempstockpos, cte
ERROR: missing FROM-clause entry for table "cte"
单击查看我的原始代码如果未在
tempstockpos
中定义cte
表,则不会在tempstockpos
中看到该表。现在显示整个代码。而不是tempstockpos中的,其中。。。。并且tempstockpos.batchid=cte.batchid
,则必须在FROM
子句中包含cte
,如:
FROM tempstockpos, cte WHERE .... AND tempstockpos.batchid = cte.batchid
或者优选更清洁且更可读的:
FROM tempstockpos INNER JOIN cte ON tempstockpos.batchid = cte.batchid WHERE ....
在代码中显示您的查询以及什么是
tempstockpos
请不要以图片形式发布代码,发布格式化文本。@下次我将使用带有\u no \u名称的\u horse \u,因为我的代码非常大,所以我不会尝试在此处更新,所以单击此处查看