I have three object tour, tour visit and Tour Suit . In that Tour is the Parent of Tour Visit and then Tour Visit is the parent of Tour Suit, So in Tour suit there is field Call property Name , I want to retrieve the data from Tour Object Is it possible to Retrieve the Property Name through Tour Object because there is no relationship between tour and tour suit , How we can write soql query for it.
Given the information you've provided, no, it is not possible to query the
Property Name from your
Tour_Suit__c object (is that perhaps supposed to be Tour Suite?) when the query is based around the
SOQL only allows us to query one level down a hierarchy (from Parent to Child), and you would need to query down two levels.
We can, however, query up to 5 levels upwards in a hierarchy. So if your query is based on
Tour_Suit__c, you could query information about the
SELECT Tour_Visit__r.Tour__r.Name FROM Tour_Suit__c WHERE Tour_Visit__r.Tour__c IN :tourIdList