I want to query objects which are in a master-detail relationship.
(The query should work without Apex code)
The query should return only masters with child records not older than 30 days,
or masters with no child records at all.
What came to my mind is:
SELECT Id FROM Campaign WHERE Id IN (SELECT xxx__campaign__c FROM xxx__child__c WHERE SystemModStamp <= LAST_N_DAYS:30) OR Id NOT IN (select xxx__campaign__c FROM xxx__child__c)
But since Semi join sub-selects are not allowed with the 'OR' operator this will unfortunately not work.
Is there a way to do this query, or do I have to split this into two separate queries?
Any suggestions will be highly appreciated.