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
LosintikfosLosintikfos 

SOQL

Hi Guys,

 

Do anyone know why this statement is not working?

 

 

SELECT Id, Name FROM Account WHERE Id IN (SELECT FirstName, LastName FROM Contact where AccountId ='00120000008rnQJAAY')

 

Cheers.

 

Best Answer chosen by Admin (Salesforce Developers) 
LosintikfosLosintikfos

I think i found the answer here: relationship query

 

 

All Answers

gotherthanthougotherthanthou

The obvious reason is that you're trying to compare ID's from Account to a query returning FirstName and LastName from contact.

 

The not-so-obvious reason is that when I try to use an IN clause with another query inside, I get a message telling me that semi-joins are not supported with this version of the API (tested using the Apex Explorer v8.0).

LosintikfosLosintikfos

Oh see!

 

 

So do anyone knows how to make join SOQL statement?

LosintikfosLosintikfos

I think i found the answer here: relationship query

 

 

This was selected as the best answer