Account__c
field is lookup in relationship__c
object. I have to get all the accounts into a list. If the same is selected for 15 relationships, I have to get the same account 15 times in the final accList. But it was getting only 1 time instead of 15 times.
List<Id> idList = new List<Id>();
List<Relationship__c> vrList = [SELECT Id,Account__c FROM Relationship__c];
system.debug('SizeOfvrList'+vrList.size()); //here the Size is 15
for(Relationship__c v : vrList){
idList.add(v.Account__C);
}
system.debug('SizeOfidlist'+idlist.size()); //idList size is 15
List<Account> accList = [SELECT Id,Name FROM Account WHERE ID IN : idList];
system.debug('SizeOfAccountLsit'+accList.size()); //here the size is 1