I am having a bit of a problem here with this statement below using tables:
[Users] Name,Email,Subscribed
[Email] Name,Email,Subscribed
Basically what needs to be accomplished is all the Subscribed Users in the Users table need to be checked against the users in the Email table to see if they exist in the table or not, and only return the users in the Users table which are not found in the Email table.
Here is the statement I’ve used, but it returns millions of rows and takes forever, and it is returning every email address in the Email table, I don’t think this is the best way to approach this issue because it is not returning accurate data. Any thoughts?
SELECT Distinct c.Name,c.Email from Users c
INNER JOIN Email e on c.Email <> e.Email
WHERE c.Subscribed=1
I think this is what you are looking for.
The INNER JOIN in your query with no ON clause is why you are getting wacky results.