Ever need to match up records for updates but there is no clear relationship to the existing data? There may be duplicates, multiple hits, or a new update may be needed. Here is some sample SQL I used when I needed to reassign contacts in SugarCRM based on a certain kind of relevance, no predictable fields or keys, the data comes in a bucket of excel. Yikes!
This applies to SugarCRM 6.x and is not tested on 7.x without retooling but the technique would help with similar data.