function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
SambitNayakSambitNayak 

Query object related in 1-many relationship

Hi,
I have a custom object Vendor Contract. Another Custom object Team Member with a look up to Vendor Contract. So there is a 1 to many relationship between Vendor Contract and Team Member.

My following query is not executing and I'm getting the error:
Query:
List<Vendor_Contract__c> contractList = [SELECT Id, (SELECT Id, Allocation_to_Team__c FROM Team_Members__r) FROM Vendor_Contract__c WHERE Id IN :listLabCont];
                          
Error:

Didn't understand relationship 'Team_Members__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.