Matching query

  • Thread starter Thread starter Lori
  • Start date Start date
L

Lori

I'm using Access 97 and am trying to write a query to find
matching records in two tables. My problem is that I have
to join on a text field...either a Name field or Address
Line One - both bad options. Is there anyway I can write
a better query...is it possible to use LIKE instead of =
in my join?

Thanks
 
Yes, you can use LIKE in the join statement. You can't do this using the query
grid, but have to do it in the SQL window.

I'm lazy, so I often build the query in the grid using an equals join and then
switch to the SQL window to modify the On clause of the join.

SELECT ...
FROM TableA INNER JOIN TableB
On TableA.[Name] LIKE "*" & TableB.[Name] & "*"
WHERE ...

That would give you matches on Name where TableA.Name was equal to TableB.Name
Or
Where TableB.Name was contained in TableA.Name

Note that this still wouldn't match
"Johnson and Company" to "Johnson and Co."
 
Back
Top