I'm trying to build a SOQL query to show the Name, Services and Contacts for accounts that have a relationship to a particular custom object, but I feel I'm missing something here:
SELECT Name, ServiceAccountAssociation__r.Name, Account.Contact.Name FROM Account WHERE ((Id IN (Select Account__c.Id from ServiceAccountAssociation__c)) AND (BillingState = 'MA'))
The error I"m getting is:
SELECT Name,ServiceAccountAssociation__r.Name ^ ERROR at Row:1:Column:13 Didn't understand relationship 'ServiceAccountAssociation__r' in field path. If you are attempting to use a custom relationship, be sure to append the '__r' after the custom relationship name. Please reference your WSDL or the describe call for the appropriate names.
The relationship is as follows:
Accounts are related to Service__c (custom object) via the ServiceAccountAssociation__c custom object. There is a master-detail relationship called Service__c on the ServiceAccountAssociation object which connects Service to Account.
I've looked at various salesforce documentation and am getting really lost...