Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
SOQL parent relationship query
List<Account> parentAccounts = new List<Account>();
for(Contact contactWithAccountInfo : [Select Name,Account.Name,Account.AnnualRevenue From Contact]){
System.debug('Contact Account Id: ' + contactWithAccountInfo.Account.Id);
parentAccounts.add(contactWithAccountInfo.Account);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.