OLI:
Select Id, Bill_to_Email__c FROM Order_Lines__c
WHERE Order__r.Bill_To_Brand_Contact__r.System_delete__c = true
Order:
Select Id, Bill_To_Brand_Contact__r.System_delete__c
FROM Order where Bill_To_Brand_Contact__r.System_delete__c = true
Cases
Select Id FROM Case WHERE Contact.System_delete__c = true
Contact:
Select Id FROM Contact where System_delete__c = true
Outdated orders of non CMs
Select Id, eWinery_Order_Date__c FROM Order_Lines__c
WHERE Order__r.Bill_To_Brand_Contact__r.Has_being_a_club_member__c = false
AND Order__r.eWinery_Date_Completed__c < LAST_N_YEARS:5
***
list<order_lines__c> oli= [Select Id FROM Order_Lines__c
WHERE Order__r.Bill_To_Brand_Contact__r.System_delete__c = tr
...
Read more »