I am very new to the SForce apex coding and am trying to get my head around subqueries using an exists statement.
I am trying to get the Accounts that are linked to a custom object via a customer property on the standard account object. Here is what i am trying:
SELECT Id, FirstName, LastName, Customer_ID__c
FROM Account
where lastName = 'TestCustomer' AND exists (SELECT Id
FROM Duplicate_ID__c
WHERE Duplicate_ID__c = Customer_ID__c)
LIMIT 100
Here is error i am getting: ERROR at Row:3Column:44 unexpectd token:'select'
Can anyone help?
Attribution to: Stephen Cossgrove
Possible Suggestion/Solution #1
There is no exists
clause in SOQL. Try following query:
SELECT
Id, FirstName, LastName, Customer_ID__c
FROM Account
WHERE
lastName = 'TestCustomer'
AND
Customer_ID__c IN (select Duplicate_ID__c from Duplicate_ID__c)
LIMIT 100
Attribution to: IvanR
This content is remixed from stackoverflow or stackexchange. Please visit https://salesforce.stackexchange.com/questions/34205