• Sathya C
  • NEWBIE
  • 10 Points
  • Member since 2016

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 1
    Replies
// student__c is child, college__c is parent. The below code to get the child record when parent information is given works
    {
          student__c [] a = [select id, name, date_of_birth__c, phone__c, email__c, address__c from student__c where     college_name__r.name = 'PEC College'];
          for(student__c s:a)
          system.debug(s);    
    }

//The code below to get parent record when child information does not.
    {
          college__c a = [select id, name, address__c, courses_offered__c, dean_name__c, number_of_students__c, year_started__c
                        from college__c where id in (select student__r where student__c.name = 'Claire Hale') ];
      }

 
// student__c is child, college__c is parent. The below code to get the child record when parent information is given works
    {
          student__c [] a = [select id, name, date_of_birth__c, phone__c, email__c, address__c from student__c where     college_name__r.name = 'PEC College'];
          for(student__c s:a)
          system.debug(s);    
    }

//The code below to get parent record when child information does not.
    {
          college__c a = [select id, name, address__c, courses_offered__c, dean_name__c, number_of_students__c, year_started__c
                        from college__c where id in (select student__r where student__c.name = 'Claire Hale') ];
      }