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
ICATLogisticsICATLogistics 

SOQL Query Help

I am attempting to write a SOQL query to find the following.   Having trouble with the "join" etc.

 

We have a Custom Object called Shipment, the parent object is Account. 

 

Related by:

Shipment.SF_Account__c = Account.Id

 

Shipment has a field called CustomerNo.  Account has a field Site.   I want a list of Shipment records where CustomerNo does NOT equal the related Account Site.

 

In SQL it would look like:

SELECT Shipment.ID, Shipment.CustomerNo, Account.Site FROM Shipment INNER JOIN Account ON Shipment.SF_Account__c = Account.ID WHERE Shipment.CustomerNo <> Account.Site

 

vbsvbs

The SOQL query should look like:

SELECT ID, CustomerNo, SF_Account__r.Site FROM Shipment WHERE CustomerNo <> SF_Account__r.Site