Following Salesforce's documentation on Parent-to-child relationship queries here:
Parent-to-child relationship queries do not use dot notation:
SELECT LastName__c, ( SELECT LastName__c FROM Daughters__r ) FROM Mother__c
I ran the following SOQL:
SELECT LastName, ( SELECT Name FROM Addresses__r ) from Contact WHERE Id = '003f400001XaiGAAAZ'
which fails with the following error
ERROR at Row:3:Column:22 Didn't understand relationship 'Addresses__r' in FROM part of query call. 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.
Can someone point out how I can change my query to make it valid SOQL?