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
TilluTillu 

Please correct this SOQL querry

I have  contact as Master and policy as detailed . i want to retrive records from contact. but this gives error.

 

the error is the subsequent querry contact.id is not recognised. how to write querry for this?

 

List<Contact> Con = [Select Id, Name from Contact where Id In (Select contact.Id from Policy__c)];

prakash_sfdcprakash_sfdc

Assuming contact is a lookup field on Policy__c

 

List<Contact> Con = [Select Id, Name from Contact where Id In (Select contact__c from Policy__c)];

 

OR 

 

List<Contact> Con = [Select Id, Name from Contact where Id In (Select contact__r.Id from Policy__c)];