You need to sign in to do that
Don't have an account?

Find contacts without and related objects
How to find contacts which do not have cases, opportunities, activities, etc so that we can delete such contacts from the database?
Thanks in advance.
Yogesh
Thanks in advance.
Yogesh
EX:
SELECT CaseNumber,ContactId FROM Case WHERE ContactId != NULL
SELECT ContactId,Id FROM OpportunityContactRole WHERE ContactId !=NULL
Then collect all the contact id's from above queries and Query from contact all records that are NOT IN the above results
SELECT Id FROM Contact WHERE Id NOT IN : <list of ids collected from above>
DELETE above resulting list
Mark as best answer if it helps you.
Thanks,
Ghanshyam Choudhari
@krisstannum1, Is there an easier way to put this in one query because I want to use the dataloader to archive the contacts.
BTW, Is there a way to know which objects have the lookups to contact
So far, I have found following objects in our instance
Events
Quotes
Lead
CampaignMember
Case
ZendeskSupportTicket