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
Yogendra RishishwarYogendra Rishishwar 

SOQL join for Case and User object

I want to retrieve CompanyName of a Case Owner . I am using below query but not working .
Select c.Owner.Email, c.Owner.CompanyName, c.Owner.Name,   c.ClosedDate, c.CaseNumber From Case c where c.CaseNumber='1002'
if i remove c.Owner.CompanyName from query then it is working fine.

So  how can i retrieve Company name of case Owner along with CaseNumber and case ClosedDate in a single Query.
If CompanyName is custom field on User object then you need to use __c at the end of field name i.e. complete API name