Accepted answer

Here's an example from MSDN of grouping in VB:

Dim query = From p In db.Products _
            Group p By p.CategoryID Into g = Group _
            Select CategoryID, MaxPrice = g.Max(Function(p) p.UnitPrice)

If you omit the "= Group", it will consider g as a function. Hope this helps.


Dim q = From n In table _
        Group n By n.AccountId Into g _
        Select g.OrderByDescending(Function(t) t.Date).First() 

Related Articles