-- Find all dup accounts SELECT full_name, preferred_email, COUNT(*) FROM accounts GROUP BY full_name, preferred_email HAVING COUNT(*) > 1; -- Deactivate duplicate account UPDATE accounts SET inactive='Y', full_name='UNUSED-'||full_name, preferred_email='UNUSED' WHERE account_id=?; DELETE FROM account_external_ids WHERE account_id=?;