简体   繁体   中英

Cannot delete from table with join in MS Access

I have this query, BadCustomerIDQuery, that returns a list of CustomerIDs to delete from a separate table, CustomerIDTable.

However I can't get it to work without errors such as "Could not delete specified table" or "Specify the table containing records you want to delete"

Attempt:

DELETE CustomerIDTable.*
FROM CustomerIDTable
INNER JOIN BadCustomerIDQuery ON BadCustomerIDQuery.CustomerID = CustomerIDTable.CustomerID

You can just use IN :

DELETE FROM CustomerIDTable
WHERE CustomerID IN (SELECT CustomerID FROM BadCustomerIDQuery)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM