XML to LinQ - GroupBy

  • Thread starter Thread starter Markus Freitag
  • Start date Start date
M

Markus Freitag

Guest
Hello,
I have a one-dimensional list.
initial list State = 0 is good, State = 1 is bad
// ------------------
Pos BoardID Index State ContentID
1 1 1 1 919000000003001
2 1 1 0 919000000003001
3 2 1 0 919000000003001
4 3 1 0 919000000003001
5 3 2 0 919000000003002
6 3 3 0 919000000003003
7 3 4 0 919000000003004
8 4 5 1 919000000003005


Group by BoardID
// ------------------
Pos BoardID
1 1
2 2
3 3
4 4

Is one of the BoardID bad (state=1) then all are bad

Group by BoardID and with the state
// ------------------
Pos BoardID State
1 1 1
2 2 0
3 3 0
4 4 1

The goal is to find all Index with a good state and how much ContentID I need.

Group by BoardID and with the good state
// ------------------
Pos BoardID Index State ContentID
1 2 1 0 919000000003001
2 3 1 0 919000000003001
3 3 2 0 919000000003002
4 3 3 0 919000000003003
5 3 4 0 919000000003004
How much index I need.
The result should be in this example 4. So I need four different ContentIDs

How can I reach this?
Thanks in advance for your help.


For better understanding

1502293.png

1502301.png


Best regards Markus

Continue reading...
 
Back
Top