KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I want to delete from a table depending on data that exists on another table that references the first, however, I have the code that works and shows the value to be deleted when I run it as a SELECT stetement, however when I change that to DELETE it gives me errors, that I don't understand why they're there. 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: 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 I am using postgres
Tags (comma-separated)
Save Edits
Cancel