- Custom child object -
Student
- Custom parent object -
College
I understand how to query all student records when a college name is given:
List<Student__c> a = [
SELECT Id, Name FROM Student__c WHERE College_Name__r.Name = 'PEC College'
];
How can I query to get college info when a student name is given?
SELECT Name FROM College__c WHERE Id IN (SELECT College__c FROM Student__c WHERE Name='Joe Schmo')