What SOSQL query can list Lead Names where the Name and Company have a duplicate. (to de-dupe Leads for the same person in the same company).

This query won't execute as Count doesn't seem to support fields as well:

SELECT name, company, COUNT() FROM lead GROUP BY name, company HAVING COUNT() > 1

  • you want COUNT(Id) – cropredy Sep 25 '19 at 22:48
  • Oh right. Thanks! – JB Cooney Sep 26 '19 at 17:38

You should be using:

SELECT name, company, COUNT(Id) FROM lead GROUP BY name, company HAVING COUNT(Id) > 1
| improve this answer | |
  • Thank You. I added (Id) and it works. – JB Cooney Sep 27 '19 at 22:34
  • Please mark the answer as accepted so as to benefit the Community. I'm glad the solution was simple. – cropredy Sep 27 '19 at 22:54

If you use duplicate rules you could build a standard report with the Duplicate Record Set Object.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.