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
swapna muthiyaluswapna muthiyalu 

select(select firstname,lastname from contact) name,industry, phone from account; why this query is not returning account name?

Best Answer chosen by swapna muthiyalu
Tarun J.Tarun J.
Hello Swapna,

In your query, accountName is nothing but alias of inner query (SELECT FirstName FROM Contacts). The column which contains deatails of all related contact is accountName. 

If you want to fetch name of account in your query, you need to add 'Name' field in your query. There is no standard field on account with the API as accountname.
In this case, your query will be:
 
SELECT (SELECT FirstName FROM Contacts), Name, Industry, Rating FROM Account


-Thanks,
TK

Did this answer your question? If not, let me know what didn't work, or if so, please mark it solved.

All Answers

Tarun J.Tarun J.
Hello Swapna,

In your query, accountName is nothing but alias of inner query (SELECT FirstName FROM Contacts). The column which contains deatails of all related contact is accountName. 

If you want to fetch name of account in your query, you need to add 'Name' field in your query. There is no standard field on account with the API as accountname.
In this case, your query will be:
 
SELECT (SELECT FirstName FROM Contacts), Name, Industry, Rating FROM Account


-Thanks,
TK

Did this answer your question? If not, let me know what didn't work, or if so, please mark it solved.
This was selected as the best answer
swapna muthiyaluswapna muthiyalu
Thanks Tarun. Its working now...
Tarun J.Tarun J.
Plz mark the answer as solved.