I have a list of:
class test
{
name,
timestamp
}
and I’d like to get all the last (newest) tests that have the same name. Many tests have same timestamp.
Eg:
name1, 2012-10-25 3:00PM
name1, 2012-10-25 3:00PM
name2, 2012-10-25 3:05PM
name2, 2012-10-25 3:05PM
name1, 2012-10-25 3:10PM
name1, 2012-10-25 3:10PM
name2, 2012-10-25 3:15PM
name2, 2012-10-25 3:15PM
I only need to get the last tests for each name:
name1, 2012-10-25 3:10PM
name1, 2012-10-25 3:10PM
name2, 2012-10-25 3:15PM
name2, 2012-10-25 3:15PM
Try this:
What happens here is first a grouping on
listbyName, and doing that I select for each group the maxTimestamp. This goesinto x. Then I rejoin the samelistto the grouped one, matching all the pairs from the grouping, this way I’m selecting all the original items matching the grouped items.