Group by two columns from a datatable

Hi there ,here is a challenging problem which I have struggling a few days
first I have to group datatable with respect to two column, if two column have the same value then secondly find sum and average values.
I can use this linq querry to group by one column but I want to group by two columns Capture
(From p In dta.Select()
Group p By ID=p.Item(“Column1”).ToString Into Group
Select Group(0)).ToArray.CopyToDataTable()
Does anybody have an idea ?
thanks in advance

@Zehra Try this Query :
(From p In dta.Select()
Group p By ID=New With { Key.a =p.Item(“Col1”),Key.b=p.Item(“Col2”)} Into Group
Select Group(0)).ToArray.CopyToDataTable()

1 Like

@supermanPunch, thanks a million. It works :slight_smile:

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.