CRM Online 'Having' clause in fetchXml RRS feed

  • Question

  • Hi,

    I have a request which has to use aggregation, more specifically, 'Having' clause in fetchXml.

    The equivalent SQL query is:

    Select emailaddress1, count(*) as count
    From contact
    Where StateCode = 0
    Group By emailaddress1
    Having count(*)>1

    I converted everything fine except the 'Having' clause.  Any thoughts?

    Tuesday, August 2, 2016 4:06 PM

All replies

  • Not all the functions are supported with Aggregation in CRM.
    You may refer the below blog for the supported examples:
    Hope this helps.

    Inogic | Blog | news@inogic.com

    If this post answers your question, please click "Mark As Answer" on the post and "Mark as Helpful"

    Wednesday, August 3, 2016 1:14 PM
  • If you are using the FetchXml in an SSRS report, then you could use the aggregation to get the counts (i.e. everything but the 'Having' clause), then use SSRS to filter the data you display. This is not great from a performance perspective, and may suffer depending on the number of records

    Microsoft CRM MVP - http://mscrmuk.blogspot.com/ http://www.excitation.co.uk

    Thursday, August 4, 2016 8:34 AM