2 Antworten
Hi Jakson,
+1 Subramani,
You can use SET of ID for adding ids in list. for exp -
set<id> AccountIdSet = new set<id>();
for (Account acc : [SELECT id FROM Account])
{
AccountIdSet.add(acc.id);
}
This set you can pass in another SOQL, like we want to fetch all contacts those are related to any account.
list<contact> contactList = [SELECT id, lastname FROM contact WHERE AccountId IN: AccountIdSet ];
Please code related question post on developer forum.
Thanks,
Raj