• Pankaj Kumar Maurya
  • NEWBIE
  • 0 Points
  • Member since 2018

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 1
    Replies
I have a SOQL query which works fine:
SELECT Id, Name, (SELECT Id,Name FROM Contacts)
                    FROM Account
                    WHERE Name = 'Apollo'

But the following queries, which have been similarly formed as the above, do not run:
SELECT Id, Candidate_Name__c, (SELECT Id,Assessment__c FROM Review__c)
                         FROM Job_Application__c
                         WHERE Candidate_Name__c = 'Jamie Sandras'
Error: "Didn't understand relationship 'Review__c' in FROM part of query call...."
 
SELECT Id, Candidate_Name__c, (SELECT Id,Assessment__c FROM Review__r)
                         FROM Job_Application__c
                         WHERE Candidate_Name__c = 'Jamie Sandras'
Error: "Didn't understand relationship 'Review__r' in FROM part of query call...."

where Review__c is child object of Job_Application__c


So I have 2 questions:

1. Is it a limitation that such queries (with sub-queries to child object) work only for standard objects and not for custom objects?

2. In the first query, why does the sub-query uses the object name "Contacts" and not "Contact" which is the actual object name?
SELECT Id, Name, (SELECT Id,Name FROM Contacts) FROM Account ....
  • December 30, 2016
  • Like
  • 0