最初のテーブルを参照する別のテーブルに存在するデータに応じてテーブルから削除したいのですが、SELECTステアメントとして実行すると削除される値が表示され、機能するコードがあります。 DELETEするとエラーが発生し、なぜそこにあるのかわかりません。
DELETE leadCustomer.* FROM coursework.leadCustomer LEFT JOIN coursework.flightBooking
ON leadCustomer.customerID = flightBooking.customerID
WHERE leadCustomer.customerID NOT IN (
SELECT customerID FROM (SELECT customerID, status FROM coursework.flightBooking) AS
StatusCount where status IN ('R','H') GROUP BY customerID
)
AND leadCustomer.customerID = 8;
エラー:
ERROR: syntax error at or near "leadCustomer"
LINE 1: DELETE leadCustomer.* FROM coursework.leadCustomer LEFT JOIN...
^
********** Error **********
ERROR: syntax error at or near "leadCustomer"
SQL state: 42601
Character: 8
私はpostgresを使用しています