INSERT INTO DDA_MatchStrings
(Unit, FamilyID, AccountNumber, MatchType, MatchString, SnapshotDate, IgnoreRecord, Merged)
SELECT
Unit, FamilyID, AccountNumber, 'EMAIL', MatchString, @SnapshotDate, 0, 0
FROM DDA_MatchStrings_temp AS tms
WHERE tms.MatchString IN
(SELECT tms.MatchString FROM DDA_MatchStrings_temp AS tms
GROUP BY tms.MatchString
HAVING COUNT(DISTINCT unit) > 1)
ORDER BY tms.MatchString
INSERT INTO DDA_MatchStrings
(Unit, FamilyID,