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
TraceyTracey 

SOQL Query not working for Cases

I want SOQL that returns Cases with the relevant Account Name

 

I tried the following SOQL statement but I'm receiving an error

 

Select c.Id, c.CaseNumber, c.AccountId, (Select a.Name From Account a) from Case

 

 

I tried following the guidelines in the following web site

http://www.salesforce.com/us/developer/docs/api/Content/sforce_api_calls_soql_relationships.htm

 

Thanks

 

Stephen

 

 

SuperfellSuperfell

Account is not a child of case, so you shouldn't be using a nested select, its just

select id, subject, account.name from case 

TraceyTracey

Hi Simon

 

Thanks for the quick response.

 

I have one more favour to ask. How would I create the SOQL to return the person who created the case (CreatedBy)

 

Thanks

 

Stephen

SuperfellSuperfell
select createdBy.Name from case