I have two objects, Opportunity(Master) and Rollout(Detail). I am trying to find Id, Name from Opportunity object who have no record in Rollout object. The id field in Rollout is Opportunity__c.

  • 1
    google rollup summary field in saleaforce
    – Himanshu
    Apr 24, 2017 at 19:25

1 Answer 1


The simplest way would be to create a roll-up summary field on the Opportunity that counts the Rollout children, and query for all those where the value of that field is 0. Otherwise:

FROM Opportunity
WHERE Id NOT IN (SELECT Opportunity__c FROM Rollout__c)

Edit: To be clear, the RUSF would be better because then you don't risk hitting a SOQL Row limit like you would with the compound query.

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.