2

次のクエリが与えられた場合

Dim Query = From c In DB.Crt _
                        Where c.Member.Locked = False _
                        And c.Member.Verified = True _
                        And c.Ct > 0 _
                        Order By c.Ct Ascending _
                        Select New With {.MemberID = c.MemberID, _
                                         .Ct = c.Ct}

の SUM でグループ化するにはどうすればよいc.ctですか?

何かのようなものSUM OF(c.Ct) > 0

4

1 に答える 1

1

これを試して:

Dim Query =
    From c In DB.Crt _
    Where c.Member.Locked = False _
    And c.Member.Verified = True _
    And c.Ct > 0 _
    Order By c.Ct Ascending _
    Group c.Ct By Key = c.MemberID Into Cts = Group _
    Select New With { .MemberID = Key, .Ct = Cts.Sum() }
于 2012-05-29T11:07:06.317 に答える