Multiple Context Conditions in a Table

I have. The model for the Case table has Id and ParentId, and the model for the Tasks table has Case__c and Case__r.ParentId.