+ Start a Discussion

Help for a SOQL Query

I had two objects . Lead__c and Oppurtunity__c.


Oppurtunity__c has a look up to Lead__c . Lead__c has many oppurtunities related to it.


I need to find if Lead__c has one oppurtuntiy or more. 

 can any one help




Try the below code snippet as reference:


lead__c []leadobj=[select id,(select id from Oppurtunity__c) from lead__c]; //use Plural name of Oppurtunity__c object

for(lead__c ll:leadobj)




                                //your logic




Did this answer your question? If not, let me know what didn't work, or if so, please mark it solved.