I'm trying to apply SQL-Like group by on a datatable I have. However I can't simply use LINQ answers others have suggested, as I don't know columns I have before runtime - user selects them. However each column will either have an Aggregate function or be included in the group by. Imagine table like this one
WW XXX YYYY
1 A B
2 A B
3 C C
4 C
I only know that user wants to group by one column - then I want to apply COUNT on the rest of the columns so the new table if user selected XXX looks like:
COUNT(WW) XXX COUNT(YYYY)
2 A 2
2 C 1