Vignesh Kumar

Vignesh Kumar

  • NA
  • 1k
  • 415.9k

sum values in datatable using linq based on conditions

Apr 23 2015 4:02 AM
Hi,
I'm having a datatable like mentioned below.
ID Percentage
1        50
1        30
2        0
2       100
Result:
ID Percentage
1         80
2       100
 
Now I need to sum the percentage for each ID and the percentage for each ID should be 0 or 100 percentage.
If any one of the ID in table doesn't have 0 or 100 I need to alert. Pls suggest me how I can do this in linq and I think its the best way.

Answers (2)