I have the following table :
Indicators(A INT, B INT, C INT, D INT, TimeInsertedLocal DateTime) .
And
Of course there are no indicators with a value of TimeInsertedLocal that is larger than the largest value of TimeInsertedLocal of all Indicators.
However, it might be that you have several indicators with a value equal to the largest value of TimeInsertedLocal.
If that is the case, you need to make groups of Indicators with the same TimeInsertedLocal, and take the group with the largest value.
var indicatorsWithLargestTimeInsertedLocal = myDbContext.Indicators
// make groups of Indicators with same TimeInsertedLocal:
.GroupBy(indicator => indicator.TimeInsertedLocal)
// put the group with the largest TimeInsertedLocal first:
.OrderByDescending(group => group.Key)
// The first group of indicators, is the group with the largest value of TimeInsertedLocal
.FirstOrDefault();
If you are certain the TimeInsertedLocal is unique, you don't have to GroupBy, there will only be one indicator with the largest TimeInsertedLocal
var indicatorWithLargestTimeInsertedLocal = myDbContext.Indicators
.OrderByDescending(indicator => indicator.TimeInsertedLocal)
.FirstOrDefault();