I have got two objects Account and AccountLocation__c with a master-detail relationship where AccountLocation__c.Account__c references Account.ID. Manual check does confirm the relationship.
The parent to child query:
SELECT Account.ID, (SELECT Account__c FROM Account.AccountLocations__r) FROM Account
returns the rows while the child to parent query:
SELECT Account__c, AccountLocations__r.Account.ID FROM AccountLocation__c
results in the error
Didn't understand relationship 'AccountLocations__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.
Another question is that the second query returns of the form
ID, AccountLocations__r[{"Account__c":id1}, {"Account__c":id2}]
Considering the cardinalities, how can I extract only the IDs here?