Not sure if the question is correct, as I'm having some trouble with what the term is for what I'm looking for exactly. Have the following data:
int? Sequence
Date theDate
int? anID
What I need to do is apply the following rules to this sequence (LINQ)
:
- no 2 elements which have a
Sequence
have the same non-nullanID
s. - no 2 elements have the same
theDate
andanID
s if one of them has aSequence
. - element N’s
theDate
is more recent than element N-1stheDate
. - element N’s
theDate
= element N-1stheDate
AND element N'sSequence
> element N-1'sSequence
.
How do I manage this? Do I need to use nested group by's? Will this be conditional group by's?
Am a little lost on my implementation and terminology and will update question if I get a better understanding of the solution.