alix-o
8/26/2013 - 11:08 PM

SOQL Query to find all records, with a specific related record. In this case, it is finding all Accounts with atleast one opportunity record

SOQL Query to find all records, with a specific related record. In this case, it is finding all Accounts with atleast one opportunity record

[Select ID, Name,
From Account 
Where npe01__One2OneContact__r.ID != Null 
AND 
//Checks to see if Account Id is in a list of Opportunity.AccountId's
Id IN (Select AccountId From Opportunity)])