Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Report shows records if two fields from 2 tables are similar

Status
Not open for further replies.

TracyT71

IS-IT--Management
Apr 2, 2007
1
US
Hi Guys-
Not sure if that is a good title, but here is what I'm trying to do:

I have two tables, both with customer names and customer DOBs. The problem is the names don't necessarily match. For instance
Table 1
CustNm DOB
Smith Jane A 12/1/86
Boyd Tony 12/1/86

Table 2
Smith Jane 12/1/86

The problem is that Tables 1 and 2 show the same customer,Jane Smith, it's just that Table 1 also includes the middle initial therefore I don't know how to have her included on my report. How do I write a query/SQL statement to include this customer because she exists in both tables? So far I have created a relationship for the DOB, but I don't know how to create a query or filter for the name so that if they are similar i want the row on my report. I also want to exclude Tony Boyd who has the same DOB, but a different name. Help!!!

 
Perhaps this will suffice (SQL code) ?
SELECT A.*
FROM [Table 1] AS A INNER JOIN [Table 2] AS B ON A.DOB = B.DOB
WHERE A.CustNm Like B.CustNm & '*'

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top