I need to generate a report with list of duplicate contacts and their duplicate count. I’m trying to run below query through Data Loader and Workbench & Export the results.

select count(id), firstname, lastname, birthdate from contact 
    GROUP BY firstname, lastname, birthdate HAVING count(Id) > 1

But I am getting below error:

Aggregate query does not support queryMore(), use LIMIT to restrict the results to a single batch.

Trying to use LIMIT 2000 per batch does not help as BULK API does not support Aggregate functions in the query and also I cannot Limit the records to 200 per each batch as there are 1 million records.

Can anyone please suggest me a solution on how to export duplicate contact's into a csv file. Is there any other way other than Data Loader/Workbench?

  • Have you evaluated Salesforce's native Duplicate Management feature?
    – David Reed
    Commented Oct 16, 2018 at 21:42
  • I am not trying to Manage Duplicates as we have a separate tool for that. Right now I am just trying to generate an excel report with the above query using data loader or any other similar tool.
    – Saha
    Commented Oct 17, 2018 at 3:32

1 Answer 1


Salesforce provides you with an option:-

Use duplicate record reports to fine-tune your duplicate and matching rules and share the results of duplicate jobs.

A duplicate records report can include these records.

  • Duplicates created when a rule alerts a user to a possible duplicate, but the user creates the duplicate anyway (to generate this report, select the Report option in a duplicate rule)
  • Records manually added to a duplicate record set
  • Records in duplicate record sets generated by duplicate jobs

In Setup, use the Quick Find box to find Report Types.

  1. Create a report type, selecting Account, Contact, Lead, or Duplicate Record Set as the primary object.
  2. If you use person accounts, distinguish them from business accounts by adding the Is Person Account field in the field layout properties for your report type.
  3. If you’re working toward complying with various data protection and privacy regulations, consider excluding personal data from the report name and description.
  4. Click Next.
  5. Relate Duplicate Record Items to the primary object that you selected. Save the report type.
  6. Give your users access to the Duplicate Record Set and Duplicate Record Items objects. Then they can create reports based on the custom record type you’ve created.

Reference:- Create Reports on Duplicate Records

There is another option I found while analysing your question:-

create a custom Formula(Text) field that concatenates the fields you want to use in your duplicate criteria.

FirstName + LastName + Email, etc.

Then create a custom Formula(Number,0) field and enter 1 as the default value.

Then create a summary report grouped by your custom Text field and Summarize your custom number field, and use conditional highlighting to highlight any group with a count > 1

Reference:- How to create a Report for finding Duplicate Contacts in my instance?

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .