I am trying to run a delete query that will delete records from a linked SQL Server table. The query runs so slowly that I have never yet seen it finish, although the component parts of the query run quickly. The SQL for the query is:
DELETE dbo_customer.*, dbo_customer.cust_code
FROM dbo_customer
WHERE (((dbo_customer.cust_code) In (select cust_code from qry_DupeRes_8_CustCodesToDelete )));
The query selects the records for deletion using a sub query, which takes customer codes from a second query (qry_DupeRes_8_CustCodesToDelete ). This second query, if I run it on its own, runs instantly, so I don’t think it’s the cause of the problem.
If I remove the sub query from the WHERE clause and replace it with something like WHERE cust_code = “71092” (cust codes are strings) then this version of the delete query also runs instantly.
I am therefore baffled. The query hangs, but its component parts work very quickly.
Ian