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
Newbie999Newbie999 

why do we have to write owner.name instead of api name owner

In the below query: SELECT Id, Name, Industry, AnnualRevenue,     ( SELECT Name, Email, BirthDate FROM Contacts )     FROM Account where name != null limit 5, why writing owner does not return records and we have to write owner.name. While writing name returns records
Best Answer chosen by Newbie999
vineet kumarvineet kumar
Hi Bhavana,

Owner is a type of Lookup field, And we have to use Dot(.) Operator to get the associated information from lookup field (Relationship field).
E.g. Owner.name, CreatedBy.name etc.

Please follow the below link for detailed information and understand Relationship Queries.
http://developer.salesforce.com/docs/atlas.en-us.soql_sosl.meta/soql_sosl/sforce_api_calls_soql_relationships.htm

All Answers

vineet kumarvineet kumar
Hi Bhavana,

Owner is a type of Lookup field, And we have to use Dot(.) Operator to get the associated information from lookup field (Relationship field).
E.g. Owner.name, CreatedBy.name etc.

Please follow the below link for detailed information and understand Relationship Queries.
http://developer.salesforce.com/docs/atlas.en-us.soql_sosl.meta/soql_sosl/sforce_api_calls_soql_relationships.htm
This was selected as the best answer
Newbie999Newbie999
yes right, Thanks :) Regards, Bhavna Kandpal