johnmerlino
Registered User.
- Local time
- Yesterday, 19:29
- Joined
- Oct 14, 2010
- Messages
- 81
Hey all,
I have a query that basically finds first and last names that match between contacts and superfluous table. Finds the first and last names of contacts table that has "," and "&" characters in them. So far these two criteria must be met. Then since I don't want to retrieve the same records from the PrepareForDuplicateCheck table, I use another INSTR and say show me only those records that aren't in the PrepareForDuplicateCheck table. And Finally I just say the state of contacts must be FL or NY. So basically I want it to return records of matching names that contain the characters I mentioned above and that aren't already in the PreparForDuplicateCheck table. This isn intended to be achieved with the below sql:
However, right now this is giving me a "Cannot open database. It may not be a database your application recognizes, or the file may be corrupt." That popup shows up after a couple of minutes running the query.
I have a query that basically finds first and last names that match between contacts and superfluous table. Finds the first and last names of contacts table that has "," and "&" characters in them. So far these two criteria must be met. Then since I don't want to retrieve the same records from the PrepareForDuplicateCheck table, I use another INSTR and say show me only those records that aren't in the PrepareForDuplicateCheck table. And Finally I just say the state of contacts must be FL or NY. So basically I want it to return records of matching names that contain the characters I mentioned above and that aren't already in the PreparForDuplicateCheck table. This isn intended to be achieved with the below sql:
Code:
SELECT contacts.id, contacts.names_1, contacts.names_2, contacts.addresses INTO Extras2
FROM contacts, superfluous, temp_table, PrepareForDuplicateCheck
WHERE (
(INSTR(CONTACTS.NAMES_1, superfluous.fullname) > 0)
Or
(INSTR(CONTACTS.NAMES_2, superfluous.fullname) > 0)
)
or
(
InStr([contacts.names_1],",")<>"0" And InStr([contacts.names_1],"&")<>"0"
or
InStr([contacts.names_2],",")<>"0" And InStr([contacts.names_2],"&")<>"0"
)
and
(
(INSTR(CONTACTS.NAMES_1, PrepareForDuplicateCheck.NAMES_1)= 0)
and
(INSTR(CONTACTS.NAMES_2, PrepareForDuplicateCheck.NAMES_2) = 0)
)
and
(
CONTACTS.us_states_and_canada = "FL"
or
CONTACTS.us_states_and_canada = "NY"
);