I am trying to create FetchXML query that will give me the Total Number of Open Leads and also the Total Number of Open Leads that do not have Open Activities against them.
I have the two queries:
Open Leads no Act:
<fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="true" aggregate="true" >
<entity name="lead" >
<link-entity name="task" from="regardingobjectid" to="leadid" link-type="outer" alias="task" >
<attribute name="regardingobjectid" aggregate="count" alias="TotalOpenLeadsNoActivities" />
</link-entity>
<filter type="and" >
<condition entityname="task" attribute="regardingobjectid" operator="null" />
<condition entityname="lead" attribute="statecode" operator="eq" value="0" />
</filter>
</entity>
</fetch>
AllOpenLeads:
<fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="true" aggregate="true" >
<entity name="lead" >
<attribute name="leadid" aggregate="count" alias="TotalOpenLeads" />
<filter type="and" >
<condition entityname="lead" attribute="statecode" operator="eq" value="0" />
</filter>
</entity>
</fetch>
Is there a way to merge them so that I simply get two "COUNT" numbers returned by one query?
Thanks.






