Unmatched Query - Using multiple fields

SAK

Registered User.
Local time
Today, 07:56
Joined
Jun 5, 2003
Messages
43
Hello,

My task is to compare our master membership table with a second table, removing matching names in the second table from the master table. (The second table are those individuals who chose not to receive a paper newsletter, so we want to save money and trees :) and not send them one.)

So to remove those names I tried the find unmatched query wizard but that only allows me to chose on one field it seems. There is no single unique identified field that would do this for both tables.

I thought if I built an unmatched query using the fields 'Last_Name' and 'Address1' and 'PostalCode' that should be sufficient for the task.

Here are portions the individual SQL statements that I need to get into one query.

FROM tblAllMembers LEFT JOIN qrySeekbyGroup ON tblAllMembers.Last_Name = qrySeekbyGroup.[Last Name]
WHERE (((qrySeekbyGroup.[Last Name]) Is Null));

FROM tblAllMembers LEFT JOIN qrySeekbyGroup ON [tblAllMembers].[Address1] = [qrySeekbyGroup].[Mailing Address Line 1]
WHERE ([qrySeekbyGroup].[Mailing Address Line 1] Is Null);

FROM tblAllMembers LEFT JOIN qrySeekbyGroup ON [tblAllMembers].[Postal_Code] = [qrySeekbyGroup].[Postal Code]
WHERE ([qrySeekbyGroup].[Postal Code] Is Null);

How is the SQL written so the find unmatched query will use all three of these sections in on query.

Thanks much for your assistance.

SAK
 
If you posted the table, it would be significantly easier to help you. I'm not going to build it to answer your question. I'm lazy, I'm tired and it's Sunday night.
 
Unmatched Query with Several Fields

After a bit of obsessing over this for a while, and plugging in different code permutations I finally hit on what I needed: :cool:

SELECT tblAllMembers.*
FROM tblAllMembers LEFT JOIN qrySeekbyGroup ON (tblAllMembers.Address1 = qrySeekbyGroup.[Mailing Address Line 1]) AND (tblAllMembers.Group_Name = qrySeekbyGroup.[Group Name]) AND (tblAllMembers.Last_Name = qrySeekbyGroup.[Last Name])
WHERE (((qrySeekbyGroup.[Group Name]) Is Null) AND ((qrySeekbyGroup.[Last Name]) Is Null) AND ((qrySeekbyGroup.[Mailing Address Line 1]) Is Null));

That uses three fields in my unmatched query and it does the trick.

SQL is very particular. :o

Thanks
 

Users who are viewing this thread

Back
Top Bottom