+ Start a Discussion
Dev org 83Dev org 83 

get count of duplicate contact name and one of duplicate contact id

The requirement is to get the all duplicate contact with firstname,email,Id, duplicate count

I have already tried this method
[SELECT FirstName,LastName,Email, count(Id) tduplicates FROM Contact GROUP BY FirstName,LastName,Email HAVING count(Id)>1]

but it didn't give the Id

please help me out here
AnudeepAnudeep (Salesforce Developers) 
You cannot include Id in any part of the SOQL. If you do so you will run into errors. You will have to process the results to do another query to get the ID's of the records.


 
RovRov

Rather than writing a SOQL to get count of duplicate contacts, i find it much easier and quicker to do in excel. 
Give this a try. 

1. Using Data Loader Export all Contacts in a .csv file
2. Create a new column and use the function CONCAT (select fields which you want to concat) . In your case  CONCAT (FirstName+LastName+Email)
3. select the new column you created in step 2, and  use Excel feature Remove Duplicates. 

If you google, you will get step by step help for steps 2 and 3