wrong sum RRS feed

  • Question

  •  I use EF 4

    this is the linq query

    List<All> groupquery = (from gq in entities.AllOrganizations                                                                    
                                      group gq by new {gq.OrganizationId,gq.ProductType,gq.Type}
                                      into x
                                          select new All
                                              Orgid = x.FirstOrDefault().OrganizationId
                                          ,TotalHits = x.Sum(col => col.Hits)
                                          , ProductType = x.FirstOrDefault().ProductType
                                          , OrgType = x.FirstOrDefault().Title                                       

    the sum i receive from this query is incorrect

    any help

    Thursday, May 9, 2013 5:47 PM

All replies

  • Hi guymalka,

    Could you please show some examples about the issue? What is the expected result and what did you get from this query?

    Currently, I didn't find anything wrong from this query.

    Best regards,

    Chester Hong
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Monday, May 13, 2013 5:23 AM