Hey all,
This statement is flawed:
Code:
SELECT contacts.names_1, contacts.names_2, contacts.addresses, contacts.cities, contacts.us_states_and_canada, contacts.zip_codes
FROM contacts, temp_query
WHERE
(
contacts.names_1 Like "*" & temp_query.first_name & "*"
and
contacts.names_1 Like "*" & temp_query.last_name & "*"
)
OR
(
contacts.names_2 Like "*" & temp_query.first_name & "*"
and
contacts.names_2 Like "*" & temp_query.last_name & "*"
)
;
If names_1 has the string doodle and if temp_query first_name or last_name has the string doo, that doodle will be returned because of the like clause. I would only want record to be returned if it had doo, not doodle.
My records could look like this in names_1 or names_2:
Clark,Kelly Smith, Sam
Clark Kelly Smith, John
I don't want to return anything like
Clarkson,Kelly Smith, Sam
Clark, Kellylin Smith, Sam
Hence, since I don't want to check for Smith, John but I want to check for Clark, Kelly or Clark Kelly, I can't check for exact match but rather string pattern:
Code:
SELECT contacts.names_1, contacts.names_2, contacts.addresses, contacts.cities, contacts.us_states_and_canada, contacts.zip_codes
FROM contacts, temp_query
WHERE
(
contacts.names_1 Like temp_query.first_name & " "
and
contacts.names_1 Like temp_query.last_name & ","
)
OR
(
contacts.names_2 Like temp_query.first_name & " "
and
contacts.names_2 Like temp_query.last_name & " "
)
;
However, this returns 0 records, even though there should at least be 80 returned records.
Thanks for any response.