Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Group by multiple columns blues
Message
 
À
Tous
Information générale
Forum:
ASP.NET
Catégorie:
LINQ
Titre:
Group by multiple columns blues
Divers
Thread ID:
01559592
Message ID:
01559592
Vues:
53
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.
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform