In asp.net c#, I have a large set of values. I'm trying to agregate rows with same values and sum some of their values (The objective is to have a row in a table with the agreggated info)... is there a way of agreggating rows with two or more columns with same values and doing a sum of a third column?
Table Example:
id | column1 | column2 |column to sum
--------+---------+----------+-------------
1 | 3 | 1 |10
2 | 3 | 1 |10
3 | 3 | 2 |10
4 | 4 | 2 |10
5 | 4 | 2 |10
6 | 7 | 3 |10
7 | 7 | 3 |10
8 | 7 | 3 |10
9 | 5 | 1 |10
10 | 5 | 4 |10
Objective: Sum values of "column to sum" of rows that have the same column1 and column2 values
It would end like this:
id | column1 | column2 |column to sum
--------+---------+----------+-------------
- | 3 | 1 |20
3 | 3 | 2 |10
- | 4 | 2 |20
- | 7 | 3 |30
9 | 5 | 1 |10
10 | 5 | 4 |10
Is there a way of doing this with EF or LINQ or SQL STATEMENTS?
Thank you