I have to write a batch that will do some updates on parent records based on children.
Let's say I have objects
Children both have a Master-Detail to parent, but now I need to query all
Parent__c record that have any children. I tried the following:
query = 'SELECT Id FROM Parent__c ' + 'WHERE Id IN (SELECT Parent__c FROM Child1__c) ' + 'OR Id IN (SELECT Parent__c FROM Child2__c)';
But that gave me this error:
First error: Semi join sub-selects are not allowed with the 'OR' operator
So the question is: how can I query all parent records that have at least 1 child?