How can I transform a DataTable in a group-by date DataTable with LINQ?
Posted
by alex
on Stack Overflow
See other posts from Stack Overflow
or by alex
Published on 2010-03-24T09:50:46Z
Indexed on
2010/03/24
9:53 UTC
Read the original article
Hit count: 245
I have a untyped DataTable that looks like this (srcTbl):
date col_1 col_2 ... col_n
1.3.2010 00:00 12.5 0 ... 100
1.3.2010 01:00 0 0 ... 100
1.3.2010 22:00 0 0 ... 100
1.3.2010 23:00 12.5 0 ... 100
...
31.3.2010 00:00 2 0 ... 100
31.3.2010 01:00 2 0 ... 200
I need to sum up the rows grouped by dates to get a DataTable like that (dstTbl):
date, col_1 col_2 ... col_n
1.3.2010 15 0 ... 400
...
31.3.2010 4 0 ... 300
Is this possible by using LINQ and if then how?
© Stack Overflow or respective owner