Skip to content
Advertisement

SLOW running query in MS access

What causing this query to execute long time. Is sub query block creating a mess?

SELECT WD.IdentityUserID, WD.Email, AD.mail
FROM WD INNER JOIN AD ON WD.IdentityUserID = AD.GGDComputerUserId
WHERE (((AD.mail) Not In (SELECT EMAIL FROM WD)));

Advertisement

Answer

I believe that the problem is that for every record of the INNER JOIN you are looping over all the records of the WD table.

SELECT WD.IdentityUserID, WD.Email, AD.mail
FROM WD 
INNER JOIN AD ON WD.IdentityUserID = AD.GGDComputerUserId
WHERE NOT EXISTS(SELECT EMAIL FROM WD WHERE EMAIL = AD.mail);
User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement