Is there a way to find duplicate emails in Query?

We want to know if there are duplicate primary emails.  Can we query that data?
1. Create an Ad-Hoc query choosing Constituents
2. Under Browse for fields in: click Email Addresses
3. Now under Select Email Addresses fields: choose Primary Email address, click the blue arrow to insert that into "Include records where" area choosing equal to Yes.
   
a. Include Records where, 
  "Email Addresses\Primary email address is equal to Yes"

3. Under Results Fields to display: 
   a. Name
   b. COUNT(Lookup ID)
   c. Lookup ID


This can also be achieved in SQL if you would like to perform the query there.  Below is the SQL script you can run to return the constituents with multiple primary email addresses.

select count (emailaddress.isprimary), constituent.lookupid, constituent.name
from emailaddress
join constituent on constituent.id = emailaddress.constituentid
where emailaddress.isprimary = '1'
group by constituent.lookupid, constituent.name
having count (emailaddress.isprimary) > 1 

Environment

 Blackbaud CRM
 4.0

Was this article helpful?