Finding occurrences of string from one table in another table

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi experts!

I have two tables Customer_Master and Mailing_List. In table Mailing_List
there is a First_Name and a Last_Name Field. In the Customer_Master there is
an Account_Name Field. I am trying to find out if anyone in the Mailing_List
table has been added to the Customer_Master table. The only way I can think
of to do this is to find all occurences of last_Name and First_Name in the
Customer_Master.Account_Name field.

Can someone help me do this?

Thank you,
 
Hi Emma
In the connection between the two tables, you can specify two fields in one
side, something like

SELECT Customer_Master.*
FROM Customer_Master INNER JOIN Mailing_List ON TableName_New.Account_Name =
Mailing_List.First_Name & " " & Mailing_List.Last_Name
 
Thank you for your reply.

However, my problem is that Customer_Master.account_name will not match up
exactly with Mailing_List.First_Name & " " & Mailing_List.Last_Name.
Account_Name could have a middle initial, last name first, first name first,
etc. . . . But Customer_Master.account_name may contain the text in both of
these fields.

Using your SQL statement is there a way to perhaps use LIKE
*Mailing_List.First_Name* AND LIKE *Mailing_List.Last_Name*? BTW, I tried
this but received a missing operand error.

Could you also explain what "TableName_New.Account_Name " means?

Thank you,
 
Hi again
Try this

SELECT Customer_Master.Account_Name, Mailing_List.Last_Name,
Mailing_List.First_Name
FROM Customer_Master, Mailing_List
WHERE (((Customer_Master.Account_Name) Like "*" & [Last_Name] & "*" And
(Customer_Master.Account_Name) Like "*" & [First_Name] & "*"))

The table name in the other post it's a typo, sorry.
 
Back
Top