This works correctly in my c#:
string xml = "<fetch aggregate=\"true\" mapping=\"logical\" ><entity name=\"product\"><attribute name=\"productid\" alias=\"productCount\" aggregate=\"count\"
/></entity></fetch>";
string xmlResult = CrmProxy.QueryFetch(xml);
But this blows up with "sql error":
string xml = "<fetch aggregate=\"true\" mapping=\"logical\" ><entity name=\"product\"><filter type='and'><condition attribute='name' operator='like' value='%O%' /></filter><attribute name=\"productid\"
alias=\"productCount\" aggregate=\"count\" /></entity></fetch>";
string xmlResult = CrmProxy.QueryFetch(xml);
The difference between the 2 is that in the 2nd one I'm trying to filter results by product name with a wildcard -- anything containing the letter "O". And I just want to get back a record count -- not actual records.
Any ideas?
HerrimanCoder