I have the next objects:
Student__c, School__c, pire__c
pire__c has the student__c as a lookup field.
school__c has the student__c as a lookup field.
I having a SOQL query on pire__c and I need to get some data from student__c which is easy - But I also need to get data from the related school__c object.
What I have so far :
[SELECT Id,Name,Student__r.Name,Student__r.hed__Gender__c,Student__r.id_number__c FROM Pire__c]
What I need to accomplish:
[SELECT Id,Name,Student__r.Name,Student__r.hed__Gender__c,Student__r.id_number__c,(SELECT Id,Name FROM *Student__r.School_Student_2_school_child_relation *) FROM Pire__c]
How can I get the related School__c from the Student__c when I make a SOQL on the Pire__c object?
Is there any easy way like I wrote?
Note:
The reason I didn't turn Student to be the main query is that it can have more than 20k records while running on Pire__c will give 1-3k (exactly what I need).
I cant do Semi-Join for example : [SELECT Id,Name FROM Student WHERE Id IN (SELECT Student__c FROM Pire__c) ]
because I need to get Data from Pire__c also...
Thanks.
I have SOQL which go on pire__c object