I hope this is a simple one, I just can't find how to get the result I want, maybe I am using the wrong keyword in SQL?
I am searching an Employee table which contains a Full Name field, this field can be "Sam" or "Mr Evans" or "Mr Sam Evans"
I am trying to find partial matches with another Names table which contains a Name field - this is usually a short name such as "Sam" or "Evans" but could be "Sam Evans"
I have tried like, with and without * as follows
SELECT tblEmployee.FullName, tblNames.Name
FROM tblEmployee, tblNames
WHERE tblEmployee.FullName Like "*" & tblNames.Name & "*"
as well as the results I do want, this query can return Employee FullName of "Mr. Samson" which I don't want. I only want to see results contaning the full word "Sam" not FullNames with Sam in part of a word within the string. So I want to see Mr. Sam Evans and Mr. Sam Smith and Ms. Sally Evans, etc.
I hope this makes sense. Many thanks for your help
Edit - solution
I have solved this - just posting in case it might help anyone with a similar problem.
WHERE " " & tblEmployee.FullName & " " Like "* " & tblNames.Name & " *"
so basically by adding a space at the beginning and the end of the Employee Full Name, I catch all the correct records. I hadn't realised you could pad out a field like this but a colleague tipped me off!