+ 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 Khatri (TK)Tarun Khatri (TK)
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 Khatri (TK)Tarun Khatri (TK)
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 Khatri (TK)Tarun Khatri (TK)
Plz mark the answer as solved.