You need to sign in to do that
Don't have an account?
Ad_Infosys
Nested query not working
The query
opportunity opp=[select name, (select count() from opportunity), stagename from opportunity];
is giving error
Error: Compile Error: Didn't understand relationship 'opportunity' in FROM part of query call. If you are attempting to use a custom relationship, be sure to append the '__r' after the custom relationship name. Please reference your WSDL or the describe call for the appropriate names. at line 12 column 21
Thanks in advance
select <fields> from opportunity where ownerid=:uid
That subquery is an invalid subquery, it's just not going to work. If you want to get a count of the open opportunities then just count the number of results that you returned on the receiving end of whatever's calling this web service.
I think you are correct.
Error: count() cannot be used with root queries.
So If I am returning an sobject from a query, I cannot send derived data along.