How to copy Ids from SOQL query results to “SET” without for loop?
List<Account> accList = [SELECT Id, Name FROM Account];
Set<Id> accIds = new Map<Id, Account>(accList).keySet();
System.debug('Ids copied to Set '+accIds);
How to copy Ids from SOQL query results to “SET” without for loop?
List<Account> accList = [SELECT Id, Name FROM Account];
Set<Id> accIds = new Map<Id, Account>(accList).keySet();
System.debug('Ids copied to Set '+accIds);
This is very helpful to fetch only ID's
ReplyDelete