I'm trying to get the latest status of a recorded from a history of statuses using LINQ. I'm having trouble with my order or maybe I'm completely off the mark.
My Code
Dim LatestStatusTable= (From RecordHistoryTable In db.RecordHistory) _
.GroupBy(Function(i) i.Status).[Select](Function(i) i.First())
Example Data
Data
ID Timestamp Status
251 2017-07-19 11:01:15.577 2
250 2017-07-14 16:15:38.543 2
249 2017-07-13 13:31:13.010 2
249 2017-07-14 04:16:08.307 1
249 2017-07-14 05:45:38.437 2
249 2017-07-14 08:00:42.253 1
249 2017-07-14 08:30:02.380 2
248 2017-07-11 15:30:28.223 2
248 2017-07-11 18:31:11.857 1
248 2017-07-11 18:49:08.510 2
Desired Output
ID Timestamp Status
251 2017-07-19 11:01:15.577 2
250 2017-07-14 16:15:38.543 2
249 2017-07-14 08:30:02.380 2
248 2017-07-11 18:49:08.510 2
Can someone please educate me and point me in the right direction?