I'm trying to the following condition: If any loan in Loans table has OutstandingAmount < 0, delete all the relevant information in the database. I have to do it in a single command and hence, I have tried using INNER JOIN:
DELETE A, B, C, D, E
FROM Loans AS T1
INNER JOIN Payments T2 ON T1.LoanID = T2.LoanID
INNER JOIN Repayments T3 ON T1.LoanID = T3.LoanID
INNER JOIN Histories T4 ON T1.LoanID = T4.LoanID
INNER JOIN LoanRequests T5 ON T1.RequestDate = T5.RequestDate AND T1.BID = T5.BID
INNER JOIN Commits T6 ON T1.RequestDate = T6.requestDate AND T1.BID = T6.BID
WHERE T1.OutstandingAmount < 0
However, this command gives me syntax error at "DELETE A, B," and I'm not even sure will this work. Any help would be greatly appreciated. Thank you.