I have a condition where I need to get list of Contacts based on many conditions, which I'm able to do but now I need to limit the number of Contacts per Account.
For the new scenario I need to switch back to inner queries, so for this case I need to switch to inner queries. Now when I use the inner queries for Contacts my batch size is too large, I want to limit the number of Contacts per Account without using inner queries.
SOQL Without Inner Query:
'Select Id,Name FROM Contacts WHERE '+ where_cond+ '
SOQL with Inner Query:
'SELECT Id,(Select Id,Name FROM Contacts WHERE '+ where_cond+ ' LIMIT : numberOfContacts) FROM Account'