Problem pulling results that are "Not Like..."

apryor

Registered User.
Local time
Today, 15:27
Joined
Feb 11, 2005
Messages
31
Hi, I have a query that displays a list of e-mail addresses based on criteria from a table, but when I try to reverse the criteria in another query (to see what does not match) it displays all of my records. Thanks in advance for your help. :D

VALID EMAIL ADD QRY (This one Works)
SELECT IMPORT_TBL.Email, IMPORT_TBL.Fname, IMPORT_TBL.Lname, IMPORT_TBL.Address1, IMPORT_TBL.Address2, IMPORT_TBL.City, IMPORT_TBL.State, IMPORT_TBL.Country, IMPORT_TBL.Zip, IMPORT_TBL.Tel, IMPORT_TBL.Gender, IMPORT_TBL.[Birth Year], IMPORT_TBL.[Birth Month], IMPORT_TBL.Birthday, IMPORT_TBL.DOB, IMPORT_TBL.[Source URL], IMPORT_TBL.[IP Address], IMPORT_TBL.[Date/time stamp]
FROM IMPORT_TBL, DOMAIN_TBL
WHERE (((IMPORT_TBL.Email) Like "*@*" & ([DOMAIN_TBL].[Domain_Name])))
GROUP BY IMPORT_TBL.Email, IMPORT_TBL.Fname, IMPORT_TBL.Lname, IMPORT_TBL.Address1, IMPORT_TBL.Address2, IMPORT_TBL.City, IMPORT_TBL.State, IMPORT_TBL.Country, IMPORT_TBL.Zip, IMPORT_TBL.Tel, IMPORT_TBL.Gender, IMPORT_TBL.[Birth Year], IMPORT_TBL.[Birth Month], IMPORT_TBL.Birthday, IMPORT_TBL.DOB, IMPORT_TBL.[Source URL], IMPORT_TBL.[IP Address], IMPORT_TBL.[Date/time stamp];


INVALID EMAIL ADD QRY (Not working, displays all records)
SELECT IMPORT_TBL.Email, IMPORT_TBL.Fname, IMPORT_TBL.Lname, IMPORT_TBL.Address1, IMPORT_TBL.Address2, IMPORT_TBL.City, IMPORT_TBL.State, IMPORT_TBL.Country, IMPORT_TBL.Zip, IMPORT_TBL.Tel, IMPORT_TBL.Gender, IMPORT_TBL.[Birth Year], IMPORT_TBL.[Birth Month], IMPORT_TBL.Birthday, IMPORT_TBL.DOB, IMPORT_TBL.[Source URL], IMPORT_TBL.[IP Address], IMPORT_TBL.[Date/time stamp]
FROM IMPORT_TBL, DOMAIN_TBL
WHERE (((IMPORT_TBL.Email) Not Like "*@*" & ([DOMAIN_TBL].[Domain_Name])))
GROUP BY IMPORT_TBL.Email, IMPORT_TBL.Fname, IMPORT_TBL.Lname, IMPORT_TBL.Address1, IMPORT_TBL.Address2, IMPORT_TBL.City, IMPORT_TBL.State, IMPORT_TBL.Country, IMPORT_TBL.Zip, IMPORT_TBL.Tel, IMPORT_TBL.Gender, IMPORT_TBL.[Birth Year], IMPORT_TBL.[Birth Month], IMPORT_TBL.Birthday, IMPORT_TBL.DOB, IMPORT_TBL.[Source URL], IMPORT_TBL.[IP Address], IMPORT_TBL.[Date/time stamp];
 
Try these two queries.

qryLike:-
SELECT IMPORT_TBL.Email, IMPORT_TBL.Fname, IMPORT_TBL.Lname, IMPORT_TBL.Address1, IMPORT_TBL.Address2, IMPORT_TBL.City, IMPORT_TBL.State, IMPORT_TBL.Country, IMPORT_TBL.Zip, IMPORT_TBL.Tel, IMPORT_TBL.Gender, IMPORT_TBL.[Birth Year], IMPORT_TBL.[Birth Month], IMPORT_TBL.Birthday, IMPORT_TBL.DOB, IMPORT_TBL.[Source URL], IMPORT_TBL.[IP Address], IMPORT_TBL.[Date/time stamp]
FROM IMPORT_TBL, DOMAIN_TBL
WHERE [IMPORT_TBL]. Like "*@" & [DOMAIN_TBL].[Domain_Name];[/b]

qryNotLike:-
SELECT IMPORT_TBL.Email, IMPORT_TBL.Fname, IMPORT_TBL.Lname, IMPORT_TBL.Address1, IMPORT_TBL.Address2, IMPORT_TBL.City, IMPORT_TBL.State, IMPORT_TBL.Country, IMPORT_TBL.Zip, IMPORT_TBL.Tel, IMPORT_TBL.Gender, IMPORT_TBL.[Birth Year], IMPORT_TBL.[Birth Month], IMPORT_TBL.Birthday, IMPORT_TBL.DOB, IMPORT_TBL.[Source URL], IMPORT_TBL.[IP Address], IMPORT_TBL.[Date/time stamp]
[b]FROM IMPORT_TBL LEFT JOIN qryLike ON [IMPORT_TBL].[Email]=[qryLike].[Email]
WHERE [qryLike].[Email] Is Null;[/b]
[color=white].[/color]
 
Last edited:
Worked like a charm!!!! Thanks for your help!!!! :D
 

Users who are viewing this thread

Back
Top Bottom