2

I have a custom object in salesforce which allows duplicates. Now I would like query this custom object and get the duplicates records with ids where the Name field is similar. How Would I query using SOQL based on the Name field to get the duplicate records?

2 Answers 2

5

You will run into limits depending on how big the object is but here is the aggregate query that will work to a point:

[Select Count(ID), Name From Account Group BY Name Having Count(ID) > 1]

Then you will have to process the results to do another query to get the ID's of the records.

You will have to do this in several steps to get to your final destination

0
SELECT  application_no__c,COUNT(Id) FROM Application__c 
GROUP BY Application_No__c HAVING COUNT(Id) > 1

My custom object is Application__c and application_no__c is the field. So, it displays records with same application_no__c.

You must log in to answer this question.

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