You need to sign in to do that
Don't have an account?
kevindotcar
SOQL Statement Syntax
Hi to all,
Is it true that SOQL statements can now perform joins? I thought that this syntax would work:
Code:
KC
Is it true that SOQL statements can now perform joins? I thought that this syntax would work:
Code:
Select a.ID, a.Account__c, a.SomeField__c, (SELECT c.AccountId, c.Name__c from Contact c) from Account a Where a.ID = c.AccountIdThanks in adv for any info/corrections
KC
No, SOQL does not support join syntax. In fact, the query you list would work, but you do not need (and cannot have) the designated WHERE clause. SOQL automatically knows about the relationship between Account and Contact, due to the relationship defined between the two objects. This type of relationship is the only way you can join two objects, so the type of WHERE clause you have in your code is not needed.
Hope this helps.
Yes, that does help.
...With the additional help of the Apex Explorer, and the info here:
http://www.salesforce.com/us/developer/docs/api/Content/sforce_api_calls_soql_relationships.htm
I was able to clarify my conceptual misunderestandings.
Thanks again for the reply.
KC
No problem. It sometimes takes a while to realize that SOQL ain't SQL.