> The reason I can't have the database do the searching for me is
> because the criteria I want to search against to find potential
> duplicates doesn't have a direct one-to-one correlation to the
> database table fields.

Hmm. Is there a way you could make them directly correlate? It's a
pretty fast DB query if you can get them to line up. If I'm
understanding it correctly, you just have a full name in the import
model and broken out first and last names in your contact model. This
can work, though you'll probably need some manual SQL. Instead of
CONCAT you want to use CONTACT_WS(' ', 'fn', 'ls) which will result in
a space between the first and last names.

SELECT * FROM contactImport WHERE full_name IN (SELECT CONCAT_WS(' ',
first_name, last_name) FROM contact)

That will match a record in contactImport with a full_name of "Joe
Blow" when there is a record in contact with a first name of "Joe" and
a last name of "Blow".

The beauty of doing the heavy lifting in SQL, even if you can't do it
in the ORM, is that you only have to bring the matches across the
wire. So instead of a minimum of 30,000 records coming out of the DB
(and each getting messed around with Cake's ORM) you get only the
dupes.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to