Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Group by multiple columns blues
Message
 
To
All
General information
Forum:
ASP.NET
Category:
LINQ
Title:
Group by multiple columns blues
Miscellaneous
Thread ID:
01559592
Message ID:
01559592
Views:
55
OK. I got this to work :
 Public Sub main()
        Dim o As New DataTable
        o.Columns.Add("Sight", GetType(String))
        o.Columns.Add("Account", GetType(String))
        o.Columns.Add("Amount", GetType(Double))
        o.Columns.Add("Amount1", GetType(Double))

        o.Rows.Add("S1", "A1",1,2)
        o.Rows.Add("S2", "A1",2,4)
        o.Rows.Add("S1", "A1",3,6)
        o.Rows.Add("S2", "A1",4,8)
        o.Rows.Add("S1", "A1",5,10)
        o.Rows.Add("S2", "A1",6,12)
        Dim q
        q = From record In o _
            Group By sight = record("Sight") & record("Account")
            Into totAmount = Sum(record.Field(Of Double)("Amount")) _
            , totAmount1 = Sum(record.Field(Of Double)("Amount1"))
            Order By totAmount1
            Select sight, totAmount, totAmount1
        For Each o1 In q
            Debug.Print(o1.ToString)
        Next
end sub
Any chance that I get Sight and Account separately in my output in this configuration?

Thanks for any light and kind regards,

Marc

If things have the tendency to go your way, do not worry. It won't last. Jules Renard.
Next
Reply
Map
View

Click here to load this message in the networking platform