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

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);
}
1. List<Account> Aop = [Select Name (Select Name, StageName From Opportunites) From Account];
2. for(Opportunity opp: acc.opportunity){
system.debug('Child '+ opp.Stagename);
}
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.
https://developer.salesforce.com/docs/atlas.en-us.soql_sosl.meta/soql_sosl/sforce_api_calls_soql_relationships_and_custom_objects.htm
https://developer.salesforce.com/docs/atlas.en-us.soql_sosl.meta/soql_sosl/sforce_api_calls_soql_relationships_understanding.htm
Please mark as Best Answer if above information was helpful so that it can help others in the future.
Thanks,