+ Start a Discussion
Robert JonesRobert Jones 

Missing doc for new SOQL multiple object SELECT?

The Winter 15 API has a change to the SOQL SELECT statement (https://developer.salesforce.com/docs/atlas.en-us.soql_sosl.meta/soql_sosl/sforce_api_calls_soql_select.htm) that allows multiple FROM objects, but no description is given for the change.

FROM objectType[,objectType...]

The error message received indicates that it's to be used with related objects:

ERROR at Row:1:Column:21
A driving SObject type has already been set, all other entity types in the FROM clause must be relationships to the initial object.  The driving object is Case.

Can we get a description of this new syntax, or correct the docs if this is something hinted before release?  The only matching forum post was from a new dev trying to do the usual but misled by the doc bnf.

SonamSonam (Salesforce Developers) 
Thanks for bringing this up Robert, let me check this with the internal team and get back to you.
Robert JonesRobert Jones
@Sonam, was there never a feedback internally here?
SonamSonam (Salesforce Developers) 
Hi Robert,

This has been updated in the Spring'15 release: https://developer.salesforce.com/docs/atlas.en-us.soql_sosl.meta/soql_sosl/sforce_api_calls_soql_select.htm

FROM can have only one object as of now: 
objectType Specifies the type of object that you want to query(). You must specify a valid object, such asAccount, and must have read-level permissions to that object.

Daniel BallingerDaniel Ballinger

Apparently you can define additional sObject types in the FROM clause, but they need to be relationships to the driving sObject. It still isn't clear why you would want to do that as you can already follow relationships in the SELECT fields.

Is there any use for defining additional entity types in a SOQL FROM clause? (https://salesforce.stackexchange.com/q/257078/102)