WITH持つクエリでのエラー "FROM句エントリを行方不明":Postgresの私はPostgresの9.1.3でこのクエリを使用しようとしています句
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
I本当に混乱しています。 WITH句は、Postgresのドキュメントごとに正しく表示されます。 WITH句で別々にクエリを実行すると、正しい結果が得られます。 fine manualから
おっと!ありがとう。診断のステップとして**停止**テーブルの名前を変更しようとしましたが、それは明らかに問題ではありません。 –