📅  最后修改于: 2022-03-11 14:55:14.750000             🧑  作者: Mango
List accounts = [SELECT Id, Name, (SELECT id FROM Contacts), (SELECT id FROM opportunities) FROM Account];
for (Account a : accounts) {
System.debug('Count of Opportunities is ' + a.Opportunities.size());
System.debug('Count of Contacts is ' + a.Contacts.size());
}