Sum values in a DataTable by a given criteria
Posted
by šljaker
on Stack Overflow
See other posts from Stack Overflow
or by šljaker
Published on 2010-04-07T14:39:33Z
Indexed on
2010/04/07
14:43 UTC
Read the original article
Hit count: 237
Which is the most effective way to sum data in the DataTable by a given criteria?
I have the following table:
KEY_1
KEY_2,
VALUE_1,
VALUE_2
Input:
01101, P, 2, 3
01101, F, 1, 1
01101, P, 4, 4
10102, F, 5, 7
Desired output (new DataTable):
01101, P, 6, 7
01101, F, 1, 1
01101, SUM, 7, 8
10102, F, 5, 7
10102, SUM, 5, 7
I need efficient algorithm, because I have 10k rows and 18 columns in a DataTable.
Thank you.
© Stack Overflow or respective owner