+ Start a Discussion
Girish Reddy 52Girish Reddy 52 

In a SOQL query when should we use plural word and singular words to fetch Standard Objects I'm little confused about this, can anyone please clear my doubt

for example: here Opportunites & Opportunity is used

1. List<Account> Aop = [Select Name (Select Name, StageName From Opportunites) From Account];

2. for(Opportunity opp: acc.opportunity){
        system.debug('Child '+ opp.Stagename);
Best Answer chosen by Girish Reddy 52
VinayVinay (Salesforce Developers) 
Hi Girish,

You need to use object API name like Account/Contact etc when you are query directly.  However, if you are dealing with relationships like fetch all contacts from Account, then we need to go for Contacts relationship name Eg. Contacts.

Check below references.

Please mark as Best Answer if above information was helpful so that it can help others in the future.