i have declared a set of id's. I initially added 2 different account id's to set as below
Set<id> acctSet = new Set<id>(); acctset.add('001c000000g0ijo'); acctset.add('001c000000g0iFJ'); system.debug('***acctSet:'+acctset);
Now for each of the above Accounts, they have 2 to 3 contacts respectively. Now i am querying them.
List<Contact> Cons = new List<Contact>([select id, AccountId from Contact where accountid IN : acctSet ORDER BY CreatedDate ASC NULLS LAST LIMIT 1]); system.debug('***cons:'+cons);
Now the above results shows only one account and its related contact(As i Limited result to 1). is this the correct behavior of sets or am i missing something. My expected output is like it should get related first created contact for both accounts.