我想在Postgres的9.1.3使用此查询:Postgres的“失踪FROM子句条目”上查询错误与条款
WITH stops AS (
SELECT citation_id,
rank() OVER (ORDER BY offense_timestamp,
defendant_dl,
offense_street_number,
offense_street_name) AS stop
FROM consistent.master
WHERE citing_jurisdiction=1
)
UPDATE consistent.master
SET arrest_id = stops.stop
WHERE citing_jurisdiction=1
AND stops.citation_id = consistent.master.citation_id;
我得到这个错误:
ERROR: missing FROM-clause entry for table "stops"
LINE 12: SET arrest_id = stops.stop
^
********** Error **********
ERROR: missing FROM-clause entry for table "stops"
SQL state: 42P01
Character: 280
我真的很困惑。 WITH子句在每个Postgres文档中显示正确。如果我单独在WITH子句中运行查询,我会得到正确的结果。
哎呀!谢谢。我想说我尝试将**停止**表格改名为诊断步骤,但这显然不是问题。 – 2012-03-10 04:38:32