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!

VB, SQL, or Both? Matching = Records between 2 tables

Status
Not open for further replies.

LowBrow

Technical User
Jun 1, 2001
100
US
I have two tables:
TableA is a master list of names, addresses, phone numbers, etc. TableB is a volunteer list. I need to write a query such that:
From TableA select specific row where lastname, firstname, mailadd = specific row from TableB.
TableB contains inaccurate information and I need to compare parts of each record to the records in TableA to pull out possible corrected information. I hope this makes sense. Here is an example:
In TableA there would be a perfect record that had
LstName FstName StAdd City State
Doe John 1234 Eastwood St New York NY

In TableB I may have a record that has:
LstName FstName StAdd City State
Doe John New York NY

In this case, I would have my query search for a distinct record that had From TableA:LstName, FrstName, City, State
= TableB LstName, FstName, City, State

I'm sure there has to be a way to write this query. If anyone has any ideas, please let me know.
Thanks!
 
For a query that returns a set of exact matches, you could try

Select TableA.* from tableA,tableB
where
tableA.LstName = TableB.LstName
and
tableA.FstName = TableB.FstName

...etc




 
Thanks Jeff,
I had tried something like this before, but it returned matches for all first names and all last names (not the exact combination of first and last names, even though I had used AND, not OR), however it seems to work now. Thanks!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top