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
bs881026bs881026 

SOQL for querying all contacts with no ralated list

Hi, There are 2 objects, Contacts and a custom object. The custom object has a lookup to Contact object.
My requirement is that I need to quey all those records from the custom object which do not have a lookup to Contact.

Please help.
​Thanks.
Akhil AnilAkhil Anil
So your query would be like this
 
Select Id, Name from CustomObject__c where Contact__c = null

Kindly mark it as an answer if your query has been resolved !