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
mahimahi 

how to select fields in relationship query

hi all,
 
i have written a query::
 
campaign[ ] camp=[select cg.name, (select ld.count() from leads ld where rating='hot') from campaign cg where name='test_mahesh' limit 1];
 
i am not sure whether its right or not.
 
if right then how can i access count() field inside this relationship query. please help me out.
 
thanks,
 
mahi
SuperfellSuperfell
You can't use count in an aggregate child query.
mahimahi

thanks a lot sir!!

now if i write

campaign[ ] camp=[select cg.name, (select ld.name from leads ld where rating='hot') from campaign cg where name='test_mahesh' limit 1];

 how should I access name fields for campaign and leads.

thanks,

mahi