I have a Junction object name AcctContactAff which creates a many-to-many relationship between Contacts and Accounts and stores (among other things) the title of the person at the account.
AcctContactAff - Contact - Account - Title
Being new to SOQL I am really struggling to get the following to work:
SELECT Id, Name, NPI__c,
(SELECT Title__c FROM AcctContactAff__r)
FROM Contact
When I run this I get the error message: "Didn't understand relationship 'AcctContactAff__r' in FROM part of query call."
I can get the query to work when I do this:
SELECT Contact__r.id, Contact__r.Name, Title__c, Name
FROM AcctContactAff__c
But I need to run the query from the Parent not the Child object.
Can anyone tell me what is wrong with the first query statement?