Remember what I have answered earlier...
1. that you should use the subquery to validate that the correct items would be updated?
2. you need to do some more research on how
These apply here as well...
Using this is just asking for trouble... IF for some reason this would work it will delete ALL entries in the Take
tables IF there is a customer names 'Jones'.
WHERE Exists (
FROM customer c
WHERE c.cust_id = t.cust_id
What you actually want to do is to select all of the loan numbers for that one customer...
What I would do is to relocate that JOIN into the subquery to find all of the Loan Numbers
FROM Take t
INNER JOIN Customer c ON t.Cust_ID = c.CustID
And then use this as a subquery to delete all of the loans first...
WHERE Loan_Number IN (
This should have removed all of the Loan entries...
Now as a follow up, remove the entries from the Take table which was used to bridge the Customers to their Loans.
WHERE Cust_ID IN (